summaryrefslogtreecommitdiff
path: root/lisp/image.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-10-29 21:42:33 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2019-10-29 21:42:39 +0100
commit19c98f762092adab01bf35d4b0c958af7d4ea59e (patch)
tree7740857748d7b0d916593181762f26db1719e62d /lisp/image.el
parent1997e3b80f1046d789c4120d50e0f1dde05e7a74 (diff)
downloademacs-19c98f762092adab01bf35d4b0c958af7d4ea59e.tar.gz
emacs-19c98f762092adab01bf35d4b0c958af7d4ea59e.tar.bz2
emacs-19c98f762092adab01bf35d4b0c958af7d4ea59e.zip
Default exotic image formats (like .webp) to image-mode
* doc/lispref/errors.texi (Standard Errors): Mention the new error. * lisp/files.el (auto-mode-alist): Add a bunch of image suffixes to the list (bug#37972) based on the output from "gm convert -list format" (i.e., graphicsmagick). * lisp/image-mode.el (image-mode): Rewrite to possibly notify the user about image-use-external-converter. (image-mode--setup-mode): Factor out into own function and don't run under `condition-case' as there's nothing here that should error. * lisp/image.el (unknown-image-type): New error. (image-type): Signal that error so that image-mode can offer sensible feedback to the user.
Diffstat (limited to 'lisp/image.el')
-rw-r--r--lisp/image.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/image.el b/lisp/image.el
index 66fb5fa5fc9..ad2ee6c6071 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -151,6 +151,8 @@ or \"ffmpeg\") is installed."
:type 'boolean
:version "27.1")
+(define-error 'unknown-image-type "Unknown image type")
+
;; Map put into text properties on images.
(defvar image-map
(let ((map (make-sparse-keymap)))
@@ -391,7 +393,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data."
(require 'image-converter)
(image-convert-p source))))))
(unless type
- (error "Cannot determine image type")))
+ (signal 'unknown-image-type "Cannot determine image type")))
(when (and (not (eq type 'image-convert))
(not (memq type (and (boundp 'image-types) image-types))))
(error "Invalid image type `%s'" type))