aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-06-04 20:40:53 +0000
committerChong Yidong2007-06-04 20:40:53 +0000
commitada9718d0fac370e92650e914f43f099f07a0753 (patch)
tree04f8e7de4f128c96a27b51ab20475c34986ecef7
parentb647fc0734847b9e2b8f6c78e09c090482dec3fb (diff)
downloademacs-ada9718d0fac370e92650e914f43f099f07a0753.tar.gz
emacs-ada9718d0fac370e92650e914f43f099f07a0753.zip
(image-type-auto-detected-p): Don't scan auto-mode-alist.
-rw-r--r--lisp/image.el27
1 files changed, 6 insertions, 21 deletions
diff --git a/lisp/image.el b/lisp/image.el
index c9269abce3e..60d9c4db39c 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -343,30 +343,15 @@ Image types are symbols like `xbm' or `jpeg'."
343;;;###autoload 343;;;###autoload
344(defun image-type-auto-detected-p () 344(defun image-type-auto-detected-p ()
345 "Return t iff the current buffer contains an auto-detectable image. 345 "Return t iff the current buffer contains an auto-detectable image.
346This function is intended to be used from `magic-mode-alist' (which see). 346This function is intended to be used from `magic-fallback-mode-alist'.
347 347
348First, compare the beginning of the buffer with `image-type-header-regexps'. 348The buffer is considered to contain an auto-detectable image if
349If an appropriate image type is found, check if that image type can be 349its beginning matches an image type in `image-type-header-regexps',
350autodetected using the variable `image-type-auto-detectable'. Finally, 350and that image type is present in `image-type-auto-detectable'."
351if `buffer-file-name' is non-nil, check if it matches another major mode
352in `auto-mode-alist' apart from `image-mode'; if there is another match,
353the autodetection is considered to have failed. Return t if all the above
354steps succeed."
355 (let* ((type (image-type-from-buffer)) 351 (let* ((type (image-type-from-buffer))
356 (auto (and type (cdr (assq type image-type-auto-detectable))))) 352 (auto (and type (cdr (assq type image-type-auto-detectable)))))
357 (and auto 353 (and auto
358 (or (eq auto t) (image-type-available-p type)) 354 (or (eq auto t) (image-type-available-p type)))))
359 (or (null buffer-file-name)
360 (not (assoc-default
361 buffer-file-name
362 (delq nil (mapcar
363 (lambda (elt)
364 (unless (memq (or (car-safe (cdr elt))
365 (cdr elt))
366 '(image-mode image-mode-maybe))
367 elt))
368 auto-mode-alist))
369 'string-match))))))
370 355
371 356
372;;;###autoload 357;;;###autoload