From mboxrd@z Thu Jan 1 00:00:00 1970 From: "robut@iinet.net.au" Subject: Re: Re: Wow -- adding images to an org file Date: Wed, 12 May 2010 07:20:34 +0800 Message-ID: <3950.1273620034@iinet.net.au> Reply-To: robut@iinet.net.au Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0134505683==" Return-path: Received: from [140.186.70.92] (port=34314 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBykn-0002Ab-9i for emacs-orgmode@gnu.org; Tue, 11 May 2010 19:20:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBykl-0003g6-NK for emacs-orgmode@gnu.org; Tue, 11 May 2010 19:20:45 -0400 Received: from webmail.icp-qv1-irony-out1.iinet.net.au ([203.59.1.146]:27605) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBykk-0003fg-Lg for emacs-orgmode@gnu.org; Tue, 11 May 2010 19:20:43 -0400 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: emacs-orgmode@gnu.org, Dan Davison --===============0134505683== Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="us-ascii"
I very much like the idea of native inline image display in Org-mode but&nb= sp; 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 ret= urns "No images to display inline".

I've tried different ways of linking that image, different image formats, r= elative 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?


Cheers,

Robert Cunningham



On Tue May 11 17:29 , Dan Davison sent:

Russell Adams <RLAdams@AdamsInfoServ.Com> writes:

> On Sat, May 08, 2010 at 12:51:41PM +0200, Carsten Dominik wrote:
>> We have now native inline image display in Org-mode, you can toggl= e it
>> with
>>
>> C-c C-x C-v
>>
>> This implementation uses overlays instead of text properties and =
>> therefore does not interfere with font-lock.
>>
>> - Carsten
>
> I'm using Org-Babel and R, and when I use C-c C-c to update the output=
> from a block of code, the image in emacs doesn't change.
>
> Ideas? v6.36

Hi Russell,

I struggled with this when images were text properties, i.e. before
Carsten's implementation using overlays (thanks for C-c C-x C-v
Carsten!)

I think the answer may be clear-image-cache. I just tried that and C-c
C-x C-v showed the new image afterwards. I'm not sure whether the
following is acceptable in terms of emacs ecology, but it seems to do
the trick:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index c52aeb0..85f1219 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15507,6 +15507,7 @@ with a description part will be inlined."
"Remove inline display of images."
(interactive)
(mapc 'delete-overlay org-inline-image-overlays)
+ (clear-image-cache)
(setq org-inline-image-overlays nil))
--8<---------------cut here---------------end--------------->8---

Note also that we can make image display happen automatically after
executing a babel block:

(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)

In fact that was what I had in mind when adding that hook; it was just
waiting for Carsten's function. So in my mind this gets us some of the
way towards org-babel as an "interactive notebook", as discussed in
another recent thread.

Dan

p.s. For what its worth, here is the code I was using to make images
appear using text properties and Org font lock. I was intending to post
this when I was happy with the image refresh stuff, but it is probably
redundant in light of the new functions using overlays. A certain amount
of messing about with image redisplay and cache functions is evident.

--8<---------------cut here---------------start------------->8---
(defun dan/org-fontify-image-links (limit)
"Display links to images as images.
If the description part of the link is empty display the image,
otherwise do nothing. This function is intended to be called
during font-lock fontification."
(let ((case-fold-search t) file image)
(and dan/org-display-inline-images
(re-search-forward
(concat "\\[\\[file:\\(" iimage-mode-image-filename-regex "\\)\\]= \\]") limit t)
(setq file (match-string 1))
(setq file (iimage-locate-file file (list default-directory)))
(setq image (create-image file))
(add-text-properties (match-beginning 0) (match-end 0) (list 'disp= lay image))
;; (clear-image-cache)
(image-refresh image)
;; (redisplay)
;; (redraw-frame)
;; (redraw-display)
;; (image-refresh image)
)))

(setq dan/org-display-inline-images t)
(add-hook 'org-font-lock-hook 'dan/org-fontify-image-links)
--8<---------------cut here---------------end--------------->8---



>
> Thanks.
>
> ------------------------------------------------------------------
> Russell Adams RLAdams@AdamsInfoServ.com
>
> PGP Key ID: 0x1160DCB3 = http://www.adamsinfoserv.com/
>
> Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gn= u.org/mailman/listinfo/emacs-orgmode

_______________________________________________
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
)

= --===============0134505683== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0134505683==-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoqiu Cui Subject: [PATCH] Re: Wow -- adding images to an org file Date: Tue, 11 May 2010 22:35:51 -0700 Message-ID: References: <3950.1273620034@iinet.net.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=59126 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OC4c5-0005Ys-ER for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OC4c1-0001n6-3q for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:36:09 -0400 Received: from lo.gmane.org ([80.91.229.12]:39294) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OC4c0-0001mX-NB for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:36:05 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OC4bw-00005U-LL for emacs-orgmode@gnu.org; Wed, 12 May 2010 07:36:00 +0200 Received: from nat-dip6.cfw-a-gci.corp.yahoo.com ([209.131.62.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 07:36:00 +0200 Received: from cbaoqiu by nat-dip6.cfw-a-gci.corp.yahoo.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 07:36:00 +0200 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: emacs-orgmode@gnu.org --=-=-= "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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=inline-images.diff 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoqiu Cui Subject: Re: Wow -- adding images to an org file Date: Tue, 11 May 2010 22:39:44 -0700 Message-ID: References: <3950.1273620034@iinet.net.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=34846 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OC4fu-0006gc-6q for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:40:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OC4ft-0002fW-1w for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:40:06 -0400 Received: from lo.gmane.org ([80.91.229.12]:40071) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OC4fs-0002fF-Mg for emacs-orgmode@gnu.org; Wed, 12 May 2010 01:40:05 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OC4fr-0001Td-JI for emacs-orgmode@gnu.org; Wed, 12 May 2010 07:40:03 +0200 Received: from nat-dip6.cfw-a-gci.corp.yahoo.com ([209.131.62.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 07:40:03 +0200 Received: from cbaoqiu by nat-dip6.cfw-a-gci.corp.yahoo.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 07:40:03 +0200 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: emacs-orgmode@gnu.org --=-=-= "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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=inline-images.diff 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=-- 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 08:07:37 +0200 Message-ID: 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=38128 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OC56g-0002H8-MD for emacs-orgmode@gnu.org; Wed, 12 May 2010 02:07:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OC56d-0006QL-Cu for emacs-orgmode@gnu.org; Wed, 12 May 2010 02:07:46 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:51401) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OC56d-0006Q3-6g for emacs-orgmode@gnu.org; Wed, 12 May 2010 02:07:43 -0400 Received: by ewy8 with SMTP id 8so1655410ewy.8 for ; Tue, 11 May 2010 23:07:41 -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 On May 12, 2010, at 7:39 AM, Baoqiu Cui wrote: > "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]] 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. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoqiu Cui Subject: Re: Wow -- adding images to an org file Date: Wed, 12 May 2010 00:55:00 -0700 Message-ID: References: <3950.1273620034@iinet.net.au> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=55606 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OC6n2-0005ho-2V for emacs-orgmode@gnu.org; Wed, 12 May 2010 03:55:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OC6mr-00064y-K3 for emacs-orgmode@gnu.org; Wed, 12 May 2010 03:55:30 -0400 Received: from lo.gmane.org ([80.91.229.12]:54389) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OC6ml-00063l-SH for emacs-orgmode@gnu.org; Wed, 12 May 2010 03:55:20 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OC6mg-0005i6-5F for emacs-orgmode@gnu.org; Wed, 12 May 2010 09:55:14 +0200 Received: from nat-dip6.cfw-a-gci.corp.yahoo.com ([209.131.62.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 09:55:14 +0200 Received: from cbaoqiu by nat-dip6.cfw-a-gci.corp.yahoo.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 09:55:14 +0200 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: emacs-orgmode@gnu.org --=-=-= 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]] ------------------------------------------------------------------------ --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=inline-images-2.diff 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=-- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoqiu Cui Subject: Re: Wow -- adding images to an org file Date: Wed, 12 May 2010 09:36:44 -0700 Message-ID: References: <3950.1273620034@iinet.net.au> <78FB5A67-BA93-42C5-BE6C-635BF5C0039C@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=48355 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCEvj-0007X3-Uu for emacs-orgmode@gnu.org; Wed, 12 May 2010 12:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCEvi-0003ST-S6 for emacs-orgmode@gnu.org; Wed, 12 May 2010 12:37:07 -0400 Received: from lo.gmane.org ([80.91.229.12]:43413) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCEvi-0003SB-Ib for emacs-orgmode@gnu.org; Wed, 12 May 2010 12:37:06 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OCEva-0007x2-VE for emacs-orgmode@gnu.org; Wed, 12 May 2010 18:36:58 +0200 Received: from nat-dip4.cfw-a-gci.corp.yahoo.com ([209.131.62.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 18:36:58 +0200 Received: from cbaoqiu by nat-dip4.cfw-a-gci.corp.yahoo.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 12 May 2010 18:36:58 +0200 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: emacs-orgmode@gnu.org Carsten Dominik writes: > 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... Thanks, Carsten. I have tried my test case for LaTeX, DocBook, and HTML exporters and everything seemed to work. -- Baoqiu