all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Baoqiu Cui <cbaoqiu@yahoo.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Re: Wow -- adding images to an org file
Date: Tue, 11 May 2010 22:35:51 -0700	[thread overview]
Message-ID: <bycaas5adhk.fsf@muchbodyking-lm.corp.yahoo.com> (raw)
In-Reply-To: 3950.1273620034@iinet.net.au

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

"robut@iinet.net.au" <robut@iinet.net.au> 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]]
   [[~/images/myImage.png]]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: inline-images.diff --]
[-- Type: text/x-patch, Size: 500 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 22 bytes --]


Regards,

-- 
Baoqiu

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

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

  reply	other threads:[~2010-05-12  5:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 23:20 Re: Wow -- adding images to an org file robut
2010-05-12  5:35 ` Baoqiu Cui [this message]
2010-05-12  5:39 ` Baoqiu Cui
2010-05-12  6:07   ` Carsten Dominik
2010-05-12  7:55     ` Baoqiu Cui
2010-05-12 12:48       ` Carsten Dominik
2010-05-12 16:36         ` Baoqiu Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bycaas5adhk.fsf@muchbodyking-lm.corp.yahoo.com \
    --to=cbaoqiu@yahoo.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.