summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-10-20 00:21:38 -0400
committerKyle Meyer <kyle@kyleam.com>2016-10-20 00:21:38 -0400
commitaafc864bcb267a7b45a7c0c3ad2a0fd06de3a1fb (patch)
tree929fd09cf0027a2b8e69ceb96e6937b7f368ef0a /lisp
parente06fb88e0fd1a56e5e239c8da63d514b2b7518b4 (diff)
downloademacs.d-aafc864bcb267a7b45a7c0c3ad2a0fd06de3a1fb.tar.gz
org-open-file-at-point: Support \includegraphics
"includegraphics" may not be part of the text returned by thing-at-point if includegraphics is passed options.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-org.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/km-org.el b/lisp/km-org.el
index 9f7c8f8..9cc1ff5 100644
--- a/lisp/km-org.el
+++ b/lisp/km-org.el
@@ -654,6 +654,14 @@ to be easily overriden.")
(buffer-substring-no-properties
(region-beginning) (region-end)))
(thing-at-point 'filename))))
+ (when (and file
+ (derived-mode-p 'latex-mode)
+ (string-match (rx (zero-or-one "includegraphics")
+ "{"
+ (group (one-or-more not-newline))
+ "}")
+ file))
+ (setq file (match-string-no-properties 1 file)))
(if (and file (file-exists-p file))
(org-open-file file)
(km/org-open-file)))))