]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust error message in image-mode
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 3 Aug 2020 06:18:39 +0000 (08:18 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 3 Aug 2020 06:18:39 +0000 (08:18 +0200)
* 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

index 1bb213c2489a9fc730afe920babe2c14b8764bc7..129529542ae9e5d1222a0f876e95d8f206e25feb 100644 (file)
@@ -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"))