emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Baoqiu Cui <cbaoqiu@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Wow -- adding images to an org file
Date: Wed, 12 May 2010 14:48:58 +0200	[thread overview]
Message-ID: <78FB5A67-BA93-42C5-BE6C-635BF5C0039C@gmail.com> (raw)
In-Reply-To: <bycbpcl4krv.fsf@muchbodyking-lm.corp.yahoo.com>

Hi Baoqiu,

thanks for the patch, I have applied it.  Hopefully this will work in  
the
export backends, but it might - otherwise we will see bug reports soon  
enough...

- Carsten


On May 12, 2010, at 9:55 AM, Baoqiu Cui wrote:

> Hi Carsten,
>
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On May 12, 2010, at 7:39 AM, Baoqiu Cui wrote:
>>
>> ...
>>
>>> 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...
>
> OK, I modified the patch a little bit and came up with a version (see
> below) that can handle the following 7 cases.  Please check if it  
> looks
> good to you.  I don't see any needed exporter changes so far...
>
> ------------------------------------------------------------------------
> * Test Inline Images
>
> 1. [[file:~/Org/GNU.png]]
> 2. [[file:GNU.png]]
> 3. [[./figures/GNU.png]]
> 4. [[../tmp/figures/GNU.png]]
> 5. [[~/Org/GNU.png]]
> 6. [[~bcui/Org/GNU.png]]
> 7. [[/tmp/GNU.png]]
> ------------------------------------------------------------------------
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 0381a26..51230b3 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -15502,12 +15502,14 @@ 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)
>   (while (re-search-forward re nil t)
> -    (setq file (expand-file-name (match-string 2)))
> +    (setq file (expand-file-name
> +		(concat (or (match-string 3) "")
> +			(match-string 4))))
>     (when (file-exists-p file)
>       (setq ov (make-overlay (match-beginning 0) (match-end 0)))
>       (overlay-put ov 'display (create-image file))
>
> Thanks,
>
> -- 
> Baoqiu
> _______________________________________________
> 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

- Carsten

  reply	other threads:[~2010-05-12 14:00 UTC|newest]

Thread overview: 14+ 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 ` [PATCH] " Baoqiu Cui
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 [this message]
2010-05-12 16:36         ` Baoqiu Cui
  -- strict thread matches above, loose matches on Subject: below --
2010-05-07  2:01 Nathan Neff
2010-05-07  2:16 ` Chris Thompson
2010-05-07  7:55   ` Carsten Dominik
2010-05-07 12:58     ` Dan Davison
2010-05-08 10:51       ` Carsten Dominik
2010-05-09 15:05         ` Daniel Martins
2010-05-09 17:23           ` Sebastian Rose
2010-05-11 19:14         ` Russell Adams
2010-05-11 21:29           ` Dan Davison
2010-05-12 12:41             ` Carsten Dominik

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=78FB5A67-BA93-42C5-BE6C-635BF5C0039C@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).