0

I'm trying to always display inline images in my org mode files.

I have images inserted as [[my-image.png]].

What I have already tried:

  1. Set startup variable (see this answer:
(setq org-startup-with-inline-images t)
  1. Set inline config (see this comment):
(setq org-display-inline-images t) 
(setq org-redisplay-inline-images t) 
(setq org-startup-with-inline-images "inlineimages")

None of the two above (or any combination of) work. When I open the file, I always see the text [[my-image.png]] instead of the image. Using C-c C-x C-v works but I need to do it every time.

I have actually another related problem which is I can't set visual-line-mode by default at startup either. Maybe I have an issue with my org-mode settings? I can't figure out what is causing these issues.

1 Answer 1

0

2) is wrong: there is a function org-display-inline-images but no variable of that name. Similarly there is a function org-redisplay-inline-images but again no variable of that name.

If you look at the doc string of org-display-inline-images, you will find the conditions that the link has to obey in order to be considered as an inline image:

An inline image is a link which follows either of these
conventions:

  1. Its path is a file with an extension matching return value
     from `image-file-name-regexp' and it has no contents.

  2. Its description consists in a single link of the previous
     type.  In this case, that link must be a well-formed plain
     or angle link, i.e., it must have an explicit \"file\" type.

I will be the first to admit that this description is NOT a model of clarity. However, it does point out the fact that there are restrictions. The last sentence in particular is telling: it must have an explicit "file" type.

A little experimentation shows that the following works (assuming there is a file foo.jpg containing the image in the same directory as the Org file):

#+STARTUP: inlineimages showall

* Inline images?

   [[file:foo.jpg]]

If you want to set it permanently, then add

(setq org-startup-with-inline-images t)

to your init file.

5
  • Thanks, I did try (setq org-startup-with-inline-images t) in my init file and that doesn't work. #+STARTUP: inlineimages showall works for the file where I put it in but ideally I would like that to be set globally somehow.
    – AEmacs
    Commented Apr 5, 2020 at 18:08
  • Maybe something in your init file curdles things: try with emacs -q, then evaluate (setq org-startup-with-inline-images t) then open the Org mode file. That should work. If it does, then something is wrong with your init file.
    – NickD
    Commented Apr 5, 2020 at 18:29
  • Thanks! Found the culprit: Setting (setq org-agenda-files '("~/org")) breaks (setq org-startup-with-inline-images t). Any idea why? If I remove the line setting the org-agenda-files then the inline images load by default.
    – AEmacs
    Commented Apr 6, 2020 at 11:15
  • I can also call (setq org-startup-with-inline-images t) before I call (setq org-agenda-files '("~/org")) and that works too. Weird.
    – AEmacs
    Commented Apr 6, 2020 at 11:16
  • That does not sound right at all: can you reproduce that behavior from emacs -q?
    – NickD
    Commented Apr 6, 2020 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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