emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: Wow -- adding images to an org file


From: Carsten Dominik
Subject: Re: [Orgmode] Re: Wow -- adding images to an org file
Date: Wed, 12 May 2010 08:07:37 +0200


On May 12, 2010, at 7:39 AM, Baoqiu Cui wrote:

"address@hidden" <address@hidden> writes:

I very much like the idea of native inline image display in Org- mode but can't
seem to make it work.

Given a 6.36 snapshot or 6.36 release and these org file contents

* Test image
Test image
[[Screenshot.png]]


I hoped org would display that image after C-c C-x C-v. Rather Org- mode returns
"No images to display inline".

I've tried different ways of linking that image, different image formats, relative vs complete paths, and my regular .emacs vs a near empty one and always the same result. If I toggle iimage-mode the image displays fine per se
but does not affect how Org-mode works.

Seems clear I am missing something simple. What?

I like the idea of inline image display too, but hit the similar
problems.  After reading the code in org.el, I found that the inline
image file link has to start with either "file:" or "./".

For example, the following two links are OK:

  [[file:~/images/myImage.png]]
  [[./figures/org-mode-unicorn.svg]]

but the following two are not:

  [[Screenshot.png]]

This one I do not want to support, because it limits what other things we
can do with links.

  [[~/images/myImage.png]]

This one on the other hand should be supported, I like that. Can you please modify the patch accordingly? I believe this will also require corresponding changes in the exporter(s) somewhere...

Thanks!

- Carsten


Here is a small patch that seems to work well for me, but I'd like
Carsten to check whether it may break anything:

diff --git a/lisp/org.el b/lisp/org.el
index 0381a26..5efc162 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15502,7 +15502,7 @@ with a description part will be inlined."
  (interactive "P")
  (org-remove-inline-images)
  (goto-char (point-min))
- (let ((re (concat "\\[\\[\\(file:\\|\\./\\)\\(~?" "[-+./_0-9a-zA- Z]+"
+  (let ((re (concat "\\[\\[\\(file:\\)?\\(~?" "[-+./_0-9a-zA-Z]+"
                    (substring (org-image-file-name-regexp) 0 -2)
                    "\\)\\]" (if include-linked "" "\\]")))
        file ov)

Regards,

--
Baoqiu
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten






reply via email to

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