Rick Frankel writes: Hello Rick, > `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: > > (defun org-display-inline-images (&optional include-linked refresh > beg end) > "..." > (interactive "P") > (when (display-graphic-p) > ^^^^^^^^^^^^^^^^^^^^^^^^ > [...]) Thanks for the report, I've attached a patch that fixes this problem (in both `org-display-inline-images' and `org-preview-latex-fragment'). However I don't know if it is the right approach or if I should try to narrow this to lower-level functions. I know that `clear-image-cache' raise this error but I haven't tried to see if it the only one. Should I try to look more at it and add a `org-clear-image-cache' which will check if a graphic display is available or is the current solution fine? Regards,