emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] make new links show as figures?


From: Rick Frankel
Subject: Re: [O] make new links show as figures?
Date: Wed, 30 Oct 2013 12:02:20 -0400
User-agent: Roundcube Webmail/0.9.0

On 2013-10-26 08:10, John Kitchin wrote:
Other than having to repeat yourself, wouldn't the
[[custom:file.ext][file:file.png]] syntax allow for most/all of the
use cases mentioned?

rick

Yes, I think [[custom:file.ext][file:file.png]] would cover all
those cases.

So it turns out that this is a REALLY simple patch (two characters):

--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18853,7 +18853,7 @@ BEG and END default to the buffer boundaries."
(widen)
(setq beg (or beg (point-min)) end (or end (point-max)))
(goto-char beg)
-   (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
+ (let ((re (concat "\\[.*\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
(substring (org-image-file-name-regexp) 0 -2)
"\\)\\]" (if include-linked "" "\\]")))
(case-fold-search t)

This seems to work in all cases I can think of (see test file below).
Let me know if this works for you and i will apply to master when i
get home and have git push access.

rick
--------- 8< --------------------
* Setup (babel me)
#+BEGIN_SRC dot :file "image1.png"
digraph { one }
#+END_SRC

#+BEGIN_SRC sh
echo "digraph { one }" > image1.dot
#+END_SRC

#+RESULTS:
[[file:image1.png]]

#+BEGIN_SRC dot :file "image2.png"
digraph { two }
#+END_SRC

#+RESULTS:
[[file:image2.png]]
* Tests
** file link
- with  path (=./=)
[[file:./image1.png]]
- without path
[[file:image1.png]]
** no uri link
- with path ( =./=)
[[./image1.png]]
- without path (this does not expand as an image)
[[image1.png]]
** with description
Note: this does not expand as an image unless
`org-display-inline-images' is called with =include-linked=  true.
[[file:./image1.png][an image]]
** image in description
[[./image1.dot][./image1.png]]
** in both
This will always display the image in the description regardless of
the value of the =include-linked= argument to
`org-display-inline-images' (but open the image in the link).

[[./image1.png][./image2.png]]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]