emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Robert Goldman <rpgoldman@sift.info>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: inline images in org-mode
Date: Wed, 15 Sep 2010 19:33:36 -0500	[thread overview]
Message-ID: <4C9165E0.4050401@sift.info> (raw)

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

             reply	other threads:[~2010-09-16  0:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16  0:33 Robert Goldman [this message]
2010-09-16 12:11 ` inline images in org-mode 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

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=4C9165E0.4050401@sift.info \
    --to=rpgoldman@sift.info \
    --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).