`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)
^^^^^^^^^^^^^^^^^^^^^^^^
[...])
rick