diff options
author | Chong Yidong <[email protected]> | 2007-06-04 20:40:53 +0000 |
---|---|---|
committer | Chong Yidong <[email protected]> | 2007-06-04 20:40:53 +0000 |
commit | ada9718d0fac370e92650e914f43f099f07a0753 (patch) | |
tree | 04f8e7de4f128c96a27b51ab20475c34986ecef7 | |
parent | b647fc0734847b9e2b8f6c78e09c090482dec3fb (diff) |
(image-type-auto-detected-p): Don't scan auto-mode-alist.
-rw-r--r-- | lisp/image.el | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/lisp/image.el b/lisp/image.el index c9269abce3..60d9c4db39 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -343,30 +343,15 @@ Image types are symbols like `xbm' or `jpeg'." ;;;###autoload (defun image-type-auto-detected-p () "Return t iff the current buffer contains an auto-detectable image. -This function is intended to be used from `magic-mode-alist' (which see). - -First, compare the beginning of the buffer with `image-type-header-regexps'. -If an appropriate image type is found, check if that image type can be -autodetected using the variable `image-type-auto-detectable'. Finally, -if `buffer-file-name' is non-nil, check if it matches another major mode -in `auto-mode-alist' apart from `image-mode'; if there is another match, -the autodetection is considered to have failed. Return t if all the above -steps succeed." +This function is intended to be used from `magic-fallback-mode-alist'. + +The buffer is considered to contain an auto-detectable image if +its beginning matches an image type in `image-type-header-regexps', +and that image type is present in `image-type-auto-detectable'." (let* ((type (image-type-from-buffer)) (auto (and type (cdr (assq type image-type-auto-detectable))))) (and auto - (or (eq auto t) (image-type-available-p type)) - (or (null buffer-file-name) - (not (assoc-default - buffer-file-name - (delq nil (mapcar - (lambda (elt) - (unless (memq (or (car-safe (cdr elt)) - (cdr elt)) - '(image-mode image-mode-maybe)) - elt)) - auto-mode-alist)) - 'string-match)))))) + (or (eq auto t) (image-type-available-p type))))) ;;;###autoload |