summaryrefslogtreecommitdiff
path: root/lisp/image-file.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-10-08 23:23:55 +0000
committerMiles Bader <miles@gnu.org>2000-10-08 23:23:55 +0000
commit33c7a00c075f8ca2aabf39493e77b7c919d27d2d (patch)
treeccb33d6caa490b562896ac00a6d1951e5e3a8703 /lisp/image-file.el
parent308374ca26a38728cdf0a65ae6ac7cd4434f0799 (diff)
(auto-image-file-mode): Move to the end of the file, because
`define-minor-mode' actually calls the mode-function if the associated variable is non-nil, which requires that all needed functions be already defined.
Diffstat (limited to 'lisp/image-file.el')
-rw-r--r--lisp/image-file.el56
1 files changed, 30 insertions, 26 deletions
diff --git a/lisp/image-file.el b/lisp/image-file.el
index d80ce39c4ae..e93f2819170 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -92,32 +92,6 @@ variable is set using \\[customize]."
;;;###autoload
-(define-minor-mode auto-image-file-mode
- "Toggle visiting of image files as images.
-With prefix argument ARG, turn on if positive, otherwise off.
-Returns non-nil if the new state is enabled.
-
-Image files are those whose name has an extension in
-`image-file-name-extensions', or matches a regexp in
-`image-file-name-regexps'."
- nil
- nil
- nil
- :global t
- :group 'image
- ;; Remove existing handler
- (let ((existing-entry
- (rassq 'image-file-handler file-name-handler-alist)))
- (when existing-entry
- (setq file-name-handler-alist
- (delq existing-entry file-name-handler-alist))))
- ;; Add new handler, if enabled
- (when auto-image-file-mode
- (push (cons (image-file-name-regexp) 'image-file-handler)
- file-name-handler-alist)))
-
-
-;;;###autoload
(defun insert-image-file (file &optional visit beg end replace)
"Insert the image file FILE into the current buffer.
Optional arguments VISIT, BEG, END, and REPLACE are interpreted as for
@@ -170,6 +144,36 @@ Optional argument ARGS are the arguments to call FUNCTION with."
(apply function args)))
+;;; Note this definition must be at the end of the file, because
+;;; `define-minor-mode' actually calls the mode-function if the
+;;; associated variable is non-nil, which requires that all needed
+;;; functions be already defined. [This is arguably a bug in d-m-m]
+;;;###autoload
+(define-minor-mode auto-image-file-mode
+ "Toggle visiting of image files as images.
+With prefix argument ARG, turn on if positive, otherwise off.
+Returns non-nil if the new state is enabled.
+
+Image files are those whose name has an extension in
+`image-file-name-extensions', or matches a regexp in
+`image-file-name-regexps'."
+ nil
+ nil
+ nil
+ :global t
+ :group 'image
+ ;; Remove existing handler
+ (let ((existing-entry
+ (rassq 'image-file-handler file-name-handler-alist)))
+ (when existing-entry
+ (setq file-name-handler-alist
+ (delq existing-entry file-name-handler-alist))))
+ ;; Add new handler, if enabled
+ (when auto-image-file-mode
+ (push (cons (image-file-name-regexp) 'image-file-handler)
+ file-name-handler-alist)))
+
+
(provide 'image-file)
;;; image-file.el ends here