5

I have image files that I have included as org-mode attachments. I would like to display them inline in emacs (as I could a hyper-linked external image).

Is there some standard way to do this?

5

I wish it would be little easier to found, but all you have to do is:

  1. Define new Org-mode link abbreviation, lets' name it att
  2. Use it like [[att:somefile.extension]]

Define new link abbreviation

(require 'org-attach)
(setq org-link-abbrev-alist '(("att" . org-attach-expand-link)))

Use it in link

Then you use it through org-insert-link as usually, just link type will be att. Here is simple example:

* TODO Some heading
:PROPERTIES:
:Attachments: someimage.png
:ID:       6b0817ee-27aa-4e7e-8a09-541ccbfee2c9
:END:

[[att:someimage.png]]

For image to actually display, I have to use org-toggle-inline-images after I add link even when I have org-startup-with-inline-images enabled. But it is same with every added image, not only those from org-attach.

Edit: I found out that org-attach is not autoloaded on Org mode load. We need to require it or org-attach-expand-link function would be undefined.

  • 1
    FWIW, org-attach was autoloaded for me when I tried this today. – MikeHoss Mar 2 at 19:48
3

The best I have found so far is to do it using org-insert-link. After having attached a PNG for example, the properties drawer looks like this:

:PROPERTIES:
:Attachments: ipython-notebook-in-emacs-with-ein.png
:ID:       91ededb1-20cc-4b88-9e6d-a03f48e985e3
:END:

I then do M-x org-insert-link (C-x C-l). When prompted, I select file: and then select the file in the subdirectory data/91/ededb.../ipython... (the data is standard, the 91 and the rest you can deduce from the ID and the attachment name).

After completing this, I am left with a file: link to the relative position of the attachment. With M-x org-toggle-inline-images you can make the linked attachment show up inline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.