From 58ceff522bec39ca4511024a0ad747e2135919f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20Wikstr=C3=B6m?= Date: Sat, 26 Oct 2019 02:29:55 +0200 Subject: [PATCH] Handle attachment links more gracefully when expanding inline images * lisp/org.el (org-display-inline-images): Introduce error-handling to ignore image display if the attachment link cannot be expanded for whatever reason. For example if attachments are relative to the buffer, but the buffer is temporary and lacks filesystem location. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 2fd38b86b..f29298266 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16722,9 +16722,9 @@ boundaries." (let ((file (if (equal "attachment" linktype) (progn (require 'org-attach) - (org-attach-expand path)) + (ignore-errors (org-attach-expand path))) (expand-file-name path)))) - (when (file-exists-p file) + (when (and file (file-exists-p file)) (let ((width ;; Apply `org-image-actual-width' specifications. (cond