diff options
| author | Miles Bader | 2000-10-08 23:23:55 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-10-08 23:23:55 +0000 |
| commit | 33c7a00c075f8ca2aabf39493e77b7c919d27d2d (patch) | |
| tree | ccb33d6caa490b562896ac00a6d1951e5e3a8703 | |
| parent | 308374ca26a38728cdf0a65ae6ac7cd4434f0799 (diff) | |
| download | emacs-33c7a00c075f8ca2aabf39493e77b7c919d27d2d.tar.gz emacs-33c7a00c075f8ca2aabf39493e77b7c919d27d2d.zip | |
(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.
| -rw-r--r-- | lisp/image-file.el | 56 |
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]." | |||
| 92 | 92 | ||
| 93 | 93 | ||
| 94 | ;;;###autoload | 94 | ;;;###autoload |
| 95 | (define-minor-mode auto-image-file-mode | ||
| 96 | "Toggle visiting of image files as images. | ||
| 97 | With prefix argument ARG, turn on if positive, otherwise off. | ||
| 98 | Returns non-nil if the new state is enabled. | ||
| 99 | |||
| 100 | Image files are those whose name has an extension in | ||
| 101 | `image-file-name-extensions', or matches a regexp in | ||
| 102 | `image-file-name-regexps'." | ||
| 103 | nil | ||
| 104 | nil | ||
| 105 | nil | ||
| 106 | :global t | ||
| 107 | :group 'image | ||
| 108 | ;; Remove existing handler | ||
| 109 | (let ((existing-entry | ||
| 110 | (rassq 'image-file-handler file-name-handler-alist))) | ||
| 111 | (when existing-entry | ||
| 112 | (setq file-name-handler-alist | ||
| 113 | (delq existing-entry file-name-handler-alist)))) | ||
| 114 | ;; Add new handler, if enabled | ||
| 115 | (when auto-image-file-mode | ||
| 116 | (push (cons (image-file-name-regexp) 'image-file-handler) | ||
| 117 | file-name-handler-alist))) | ||
| 118 | |||
| 119 | |||
| 120 | ;;;###autoload | ||
| 121 | (defun insert-image-file (file &optional visit beg end replace) | 95 | (defun insert-image-file (file &optional visit beg end replace) |
| 122 | "Insert the image file FILE into the current buffer. | 96 | "Insert the image file FILE into the current buffer. |
| 123 | Optional arguments VISIT, BEG, END, and REPLACE are interpreted as for | 97 | 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." | |||
| 170 | (apply function args))) | 144 | (apply function args))) |
| 171 | 145 | ||
| 172 | 146 | ||
| 147 | ;;; Note this definition must be at the end of the file, because | ||
| 148 | ;;; `define-minor-mode' actually calls the mode-function if the | ||
| 149 | ;;; associated variable is non-nil, which requires that all needed | ||
| 150 | ;;; functions be already defined. [This is arguably a bug in d-m-m] | ||
| 151 | ;;;###autoload | ||
| 152 | (define-minor-mode auto-image-file-mode | ||
| 153 | "Toggle visiting of image files as images. | ||
| 154 | With prefix argument ARG, turn on if positive, otherwise off. | ||
| 155 | Returns non-nil if the new state is enabled. | ||
| 156 | |||
| 157 | Image files are those whose name has an extension in | ||
| 158 | `image-file-name-extensions', or matches a regexp in | ||
| 159 | `image-file-name-regexps'." | ||
| 160 | nil | ||
| 161 | nil | ||
| 162 | nil | ||
| 163 | :global t | ||
| 164 | :group 'image | ||
| 165 | ;; Remove existing handler | ||
| 166 | (let ((existing-entry | ||
| 167 | (rassq 'image-file-handler file-name-handler-alist))) | ||
| 168 | (when existing-entry | ||
| 169 | (setq file-name-handler-alist | ||
| 170 | (delq existing-entry file-name-handler-alist)))) | ||
| 171 | ;; Add new handler, if enabled | ||
| 172 | (when auto-image-file-mode | ||
| 173 | (push (cons (image-file-name-regexp) 'image-file-handler) | ||
| 174 | file-name-handler-alist))) | ||
| 175 | |||
| 176 | |||
| 173 | (provide 'image-file) | 177 | (provide 'image-file) |
| 174 | 178 | ||
| 175 | ;;; image-file.el ends here | 179 | ;;; image-file.el ends here |