lisp/org.el: Do not inline images when no graphic display is available
commit168c5584f5a41c4c0890f4caa89fc11cff021c4e
authorGrégoire Jadi <gregoire.jadi@gmail.com>
Wed, 1 May 2013 17:19:57 +0000 (1 19:19 +0200)
committerGrégoire Jadi <gregoire.jadi@gmail.com>
Thu, 2 May 2013 08:08:14 +0000 (2 10:08 +0200)
tree298955af241afdc76252351c026eabff94c81ea5
parent73ce77f991f0adffe5ad6459eeca8f3bc38e54c8
lisp/org.el: Do not inline images when no graphic display is available

* lisp/org.el (org-preview-latex-fragment)
(org-display-inline-images): Detect whether a graphic display is
available before inlining images to prevent an error.

Thanks to Rick Frankel for the report and the solution.

> `org-startup-with-inline-images' is a customizable variable. The
> problem is that if an org file is visited in a non-graphics buffer (or
> batch), `org-display-inline-images' is called an throws an error
> ("Non-X frame used").
>
> This problem also occurs when e.g., `org-babel-after-execute-hook' is
> set to 'org-display-inline-images (which can be mitigated by not
> setting the hook in a non-x frame).
>
> Since the startup variable is a customization, and causes problems if
> not set programatically, IMHO, the best solution would be to wrap the
> `org-display-inline-images' function in a test so that is is a no-op
> on non graphic displays:
lisp/org.el