From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Wow -- adding images to an org file Date: Wed, 12 May 2010 14:48:58 +0200 Message-ID: <78FB5A67-BA93-42C5-BE6C-635BF5C0039C@gmail.com> References: <3950.1273620034@iinet.net.au> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=56867 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCCU3-0000Qm-0c for emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCCU1-0003cw-3y for emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:22 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:51789) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCCU0-0003cl-Uq for emacs-orgmode@gnu.org; Wed, 12 May 2010 10:00:21 -0400 Received: by ewy8 with SMTP id 8so20697ewy.8 for ; Wed, 12 May 2010 07:00:19 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Baoqiu Cui Cc: emacs-orgmode@gnu.org 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 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