From 26b9a1da63bab8c8ee00a484df46db6ed57e2317 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 3 Aug 2020 08:18:39 +0200 Subject: [PATCH] Adjust error message in image-mode * lisp/image-mode.el (image-mode): Even when `image-user-external-converter' is on, we may get `unknown-image-type' (bug#39994). Adjust the error message in that case. --- lisp/image-mode.el | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 1bb213c2489..129529542ae 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -614,21 +614,23 @@ Key bindings: (if (not (image-get-display-property)) (progn (when (condition-case err - (progn - (image-toggle-display-image) - t) - (unknown-image-type - (image-mode-as-text) - (funcall - (if (called-interactively-p 'any) 'error 'message) - "Unknown image type; consider switching `image-use-external-converter' on") - nil) - (error - (image-mode-as-text) - (funcall - (if (called-interactively-p 'any) 'error 'message) - "Cannot display image: %s" (cdr err)) - nil)) + (progn + (image-toggle-display-image) + t) + (unknown-image-type + (image-mode-as-text) + (funcall + (if (called-interactively-p 'any) 'error 'message) + (if image-use-external-converter + "Unknown image type" + "Unknown image type; consider switching `image-use-external-converter' on")) + nil) + (error + (image-mode-as-text) + (funcall + (if (called-interactively-p 'any) 'error 'message) + "Cannot display image: %s" (cdr err)) + nil)) ;; If attempt to display the image fails. (if (not (image-get-display-property)) (error "Invalid image")) -- 2.39.2