emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* inline images in org-mode
@ 2010-09-16  0:33 Robert Goldman
  2010-09-16 12:11 ` Dan Davison
  2010-09-16 12:32 ` Sebastian Rose
  0 siblings, 2 replies; 9+ messages in thread
From: Robert Goldman @ 2010-09-16  0:33 UTC (permalink / raw)
  To: Org Mode

I was looking for a way to put illustrations in my org-mode files so
that I could actually look at them while editing the org stuff.  I found
a post a while ago suggesting using iimage mode (which is included with
the Aquamacs that I use, and is readily available if you don't have it
with your emacs).

I found I needed to do a little customization to make iimage work for
me, so I thought I would post the details in case they were useful to
anyone else.

Here's the bit I added to my org configuration to make this work:

(add-hook 'org-mode-hook
          '(lambda ()
            ;; unnecessary
            ;; (make-variable-buffer-local
'iimage-mode-image-filename-regex)
            (let ((file-extension-regex
                   (regexp-opt (nconc (mapcar #'upcase
                                              image-file-name-extensions)
                                      image-file-name-extensions)
                               t)))
              (setq iimage-mode-image-regex-alist
                    (list
                     (cons
                      (concat
                       "\\[\\["
                       (regexp-quote "file:")
                       "\\([^]]+\." file-extension-regex "\\)"
                       "\\]"
                       "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
                       "\\]")
                      1))))))

Note that this /only/ displays inline local (file) links, not http
images.  It wouldn't be hard to add that --- I built the above by
copying and modifying the org-bracket-link-analytic-regexp variable
initialization.  If one wanted to put this more generally into org-mode,
it would probably be right to make the iimage-mode-image-regex-alist be
under control of some org customization (to handle local versus all
images, etc.).

I don't generally want iimage mode on in all of my org-mode buffers, so
I use the file variables block to engage iimage mode where I want it.
If you'd like it always to be on, then you can just add iimage-mode
(it's a minor mode) to your org-mode-hook.

Hope that's of interest to someone...

Cheers,
r

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16  0:33 inline images in org-mode Robert Goldman
@ 2010-09-16 12:11 ` Dan Davison
  2010-09-16 12:37   ` Robert Goldman
  2010-09-16 12:32 ` Sebastian Rose
  1 sibling, 1 reply; 9+ messages in thread
From: Dan Davison @ 2010-09-16 12:11 UTC (permalink / raw)
  To: rpgoldman; +Cc: Org Mode

Robert Goldman <rpgoldman@sift.info> writes:

> I was looking for a way to put illustrations in my org-mode files so
> that I could actually look at them while editing the org stuff.  I found
> a post a while ago suggesting using iimage mode (which is included with
> the Aquamacs that I use, and is readily available if you don't have it
> with your emacs).

Hi Robert,

There's already org-display-inline-images, which iIrc uses overlays
rather than the text properties used by iimage. Does your route offer
advantages over this?

Dan

>
> I found I needed to do a little customization to make iimage work for
> me, so I thought I would post the details in case they were useful to
> anyone else.
>
> Here's the bit I added to my org configuration to make this work:
>
> (add-hook 'org-mode-hook
>           '(lambda ()
>             ;; unnecessary
>             ;; (make-variable-buffer-local
> 'iimage-mode-image-filename-regex)
>             (let ((file-extension-regex
>                    (regexp-opt (nconc (mapcar #'upcase
>                                               image-file-name-extensions)
>                                       image-file-name-extensions)
>                                t)))
>               (setq iimage-mode-image-regex-alist
>                     (list
>                      (cons
>                       (concat
>                        "\\[\\["
>                        (regexp-quote "file:")
>                        "\\([^]]+\." file-extension-regex "\\)"
>                        "\\]"
>                        "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
>                        "\\]")
>                       1))))))
>
> Note that this /only/ displays inline local (file) links, not http
> images.  It wouldn't be hard to add that --- I built the above by
> copying and modifying the org-bracket-link-analytic-regexp variable
> initialization.  If one wanted to put this more generally into org-mode,
> it would probably be right to make the iimage-mode-image-regex-alist be
> under control of some org customization (to handle local versus all
> images, etc.).
>
> I don't generally want iimage mode on in all of my org-mode buffers, so
> I use the file variables block to engage iimage mode where I want it.
> If you'd like it always to be on, then you can just add iimage-mode
> (it's a minor mode) to your org-mode-hook.
>
> Hope that's of interest to someone...
>
> Cheers,
> r
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16  0:33 inline images in org-mode Robert Goldman
  2010-09-16 12:11 ` Dan Davison
@ 2010-09-16 12:32 ` Sebastian Rose
  2010-09-16 12:41   ` Robert Goldman
  1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Rose @ 2010-09-16 12:32 UTC (permalink / raw)
  To: rpgoldman; +Cc: Org Mode

Robert Goldman <rpgoldman@sift.info> writes:
> I was looking for a way to put illustrations in my org-mode files so
> that I could actually look at them while editing the org stuff.  I found
> a post a while ago suggesting using iimage mode (which is included with
> the Aquamacs that I use, and is readily available if you don't have it
> with your emacs).
>
> I found I needed to do a little customization to make iimage work for
> me, so I thought I would post the details in case they were useful to
> anyone else.


Hi Robert,


just use `org-display-inline-images' or `org-toggle-inline-images'.
Not sure if it works with Aquamacs.


HTH

  Sebastian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 12:11 ` Dan Davison
@ 2010-09-16 12:37   ` Robert Goldman
  2010-09-16 12:48     ` Dan Davison
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Goldman @ 2010-09-16 12:37 UTC (permalink / raw)
  To: Dan Davison; +Cc: Org Mode

On 9/16/10 Sep 16 -7:11 AM, Dan Davison wrote:
> Robert Goldman <rpgoldman@sift.info> writes:
> 
>> I was looking for a way to put illustrations in my org-mode files so
>> that I could actually look at them while editing the org stuff.  I found
>> a post a while ago suggesting using iimage mode (which is included with
>> the Aquamacs that I use, and is readily available if you don't have it
>> with your emacs).
> 
> Hi Robert,
> 
> There's already org-display-inline-images, which iIrc uses overlays
> rather than the text properties used by iimage. Does your route offer
> advantages over this?

Nope.  Just didn't know it was there.  It's not in the manual (if I get
a chance, I'll try to write up a patch, or maybe someone else can); the
only thing I found on inline images was about export to HTML.  So then I
googled, and found the material on iimage only, not o-d-i-i.

Actually, having said that, on Aquamacs, o-d-i-i doesn't seem to work
well.  For reasons I'm too ignorant to explain, o-d-i-i causes the
images to flash repeatedly, instead of simply being displayed....

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 12:32 ` Sebastian Rose
@ 2010-09-16 12:41   ` Robert Goldman
  2010-09-16 13:46     ` Sebastian Rose
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Goldman @ 2010-09-16 12:41 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org Mode

On 9/16/10 Sep 16 -7:32 AM, Sebastian Rose wrote:
> Robert Goldman <rpgoldman@sift.info> writes:
>> I was looking for a way to put illustrations in my org-mode files so
>> that I could actually look at them while editing the org stuff.  I found
>> a post a while ago suggesting using iimage mode (which is included with
>> the Aquamacs that I use, and is readily available if you don't have it
>> with your emacs).
>>
>> I found I needed to do a little customization to make iimage work for
>> me, so I thought I would post the details in case they were useful to
>> anyone else.
> 
> 
> Hi Robert,
> 
> 
> just use `org-display-inline-images' or `org-toggle-inline-images'.
> Not sure if it works with Aquamacs.

Doesn't seem to (see earlier response).

Suggestion: add documentation of this to Markup>Images and tables in the
org manual?  I'm still not entirely sure how to use it.  Is there some
magic I can put in the Local Variables block that will cause the images
to be displayed on startup?

# org-display-inline-images: t

doesn't seem to do this --- I still needed to call o-d-i-i or o-t-i-i
even with that in the block.

I'm willing to write up the manual patch; I'm just not entirely sure
what it should say (and whether my proposed location is the right one).

best,
r

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 12:37   ` Robert Goldman
@ 2010-09-16 12:48     ` Dan Davison
  0 siblings, 0 replies; 9+ messages in thread
From: Dan Davison @ 2010-09-16 12:48 UTC (permalink / raw)
  To: rpgoldman; +Cc: Org Mode

Robert Goldman <rpgoldman@sift.info> writes:

> On 9/16/10 Sep 16 -7:11 AM, Dan Davison wrote:
>> Robert Goldman <rpgoldman@sift.info> writes:
>> 
>>> I was looking for a way to put illustrations in my org-mode files so
>>> that I could actually look at them while editing the org stuff.  I found
>>> a post a while ago suggesting using iimage mode (which is included with
>>> the Aquamacs that I use, and is readily available if you don't have it
>>> with your emacs).
>> 
>> Hi Robert,
>> 
>> There's already org-display-inline-images, which iIrc uses overlays
>> rather than the text properties used by iimage. Does your route offer
>> advantages over this?
>
> Nope.  Just didn't know it was there.  It's not in the manual (if I get
> a chance, I'll try to write up a patch, or maybe someone else can);

Right, good catch. Someone needs to add it.

> the
> only thing I found on inline images was about export to HTML.  So then I
> googled, and found the material on iimage only, not o-d-i-i.
>
> Actually, having said that, on Aquamacs, o-d-i-i doesn't seem to work
> well.  For reasons I'm too ignorant to explain, o-d-i-i causes the
> images to flash repeatedly, instead of simply being displayed....

Hmm, I don't think this is a good guess, but if you're using
org-indent-mode does turning it off help?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 12:41   ` Robert Goldman
@ 2010-09-16 13:46     ` Sebastian Rose
  2010-09-16 15:04       ` Robert Goldman
  0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Rose @ 2010-09-16 13:46 UTC (permalink / raw)
  To: rpgoldman; +Cc: Org Mode

Robert Goldman <rpgoldman@sift.info> writes:
> ... Is there some
> magic I can put in the Local Variables block that will cause the images
> to be displayed on startup?
>
> # org-display-inline-images: t



# Local Variables:
# mode: Org
# eval: (org-display-inline-images)
# End:


  Sebastian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 13:46     ` Sebastian Rose
@ 2010-09-16 15:04       ` Robert Goldman
  2010-09-29  6:20         ` Carsten Dominik
  0 siblings, 1 reply; 9+ messages in thread
From: Robert Goldman @ 2010-09-16 15:04 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org Mode

On 9/16/10 Sep 16 -8:46 AM, Sebastian Rose wrote:
> Robert Goldman <rpgoldman@sift.info> writes:
>> ... Is there some
>> magic I can put in the Local Variables block that will cause the images
>> to be displayed on startup?
>>
>> # org-display-inline-images: t
> 
> 
> 
> # Local Variables:
> # mode: Org
> # eval: (org-display-inline-images)
> # End:
> 
> 
>   Sebastian

Would it be reasonable to augment org's processing of #+ directives so
that an org user can specify there instead of using the local variables,
which is less user-friendly?

best,
r

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: inline images in org-mode
  2010-09-16 15:04       ` Robert Goldman
@ 2010-09-29  6:20         ` Carsten Dominik
  0 siblings, 0 replies; 9+ messages in thread
From: Carsten Dominik @ 2010-09-29  6:20 UTC (permalink / raw)
  To: rpgoldman; +Cc: Org Mode


On Sep 16, 2010, at 5:04 PM, Robert Goldman wrote:

> On 9/16/10 Sep 16 -8:46 AM, Sebastian Rose wrote:
>> Robert Goldman <rpgoldman@sift.info> writes:
>>> ... Is there some
>>> magic I can put in the Local Variables block that will cause the  
>>> images
>>> to be displayed on startup?
>>>
>>> # org-display-inline-images: t
>>
>>
>>
>> # Local Variables:
>> # mode: Org
>> # eval: (org-display-inline-images)
>> # End:
>>
>>
>>  Sebastian
>
> Would it be reasonable to augment org's processing of #+ directives so
> that an org user can specify there instead of using the local  
> variables,
> which is less user-friendly?

Yes.  I have just implemented startup keywords `inlineimages' and
`noinlineimages', as well as a new variable
`org-startup-with-inline-images' for a global setting.

Cheers

- Carsten

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-29  6:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-16  0:33 inline images in org-mode Robert Goldman
2010-09-16 12:11 ` Dan Davison
2010-09-16 12:37   ` Robert Goldman
2010-09-16 12:48     ` Dan Davison
2010-09-16 12:32 ` Sebastian Rose
2010-09-16 12:41   ` Robert Goldman
2010-09-16 13:46     ` Sebastian Rose
2010-09-16 15:04       ` Robert Goldman
2010-09-29  6:20         ` Carsten Dominik

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