Mercurial > emacs
comparison lisp/emacs-lisp/easy-mmode.el @ 85114:5039706521c9
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-875
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 09 Oct 2007 08:52:57 +0000 |
parents | 992e87082552 03a3e0a6776c |
children | 771c063a16df bdb3fe0ba9fa |
comparison
equal
deleted
inserted
replaced
85113:82b4a12fd080 | 85114:5039706521c9 |
---|---|
137 init-value nil lighter nil keymap nil)) | 137 init-value nil lighter nil keymap nil)) |
138 ((keywordp lighter) | 138 ((keywordp lighter) |
139 (setq body (list* lighter keymap body) lighter nil keymap nil)) | 139 (setq body (list* lighter keymap body) lighter nil keymap nil)) |
140 ((keywordp keymap) (push keymap body) (setq keymap nil))) | 140 ((keywordp keymap) (push keymap body) (setq keymap nil))) |
141 | 141 |
142 (let* ((last-message (current-message)) | 142 (let* ((last-message (make-symbol "last-message")) |
143 (mode-name (symbol-name mode)) | 143 (mode-name (symbol-name mode)) |
144 (pretty-name (easy-mmode-pretty-mode-name mode lighter)) | 144 (pretty-name (easy-mmode-pretty-mode-name mode lighter)) |
145 (globalp nil) | 145 (globalp nil) |
146 (set nil) | 146 (set nil) |
147 (initialize nil) | 147 (initialize nil) |
148 (group nil) | 148 (group nil) |
220 With zero or negative ARG turn mode off. | 220 With zero or negative ARG turn mode off. |
221 \\{%s}") pretty-name keymap-sym)) | 221 \\{%s}") pretty-name keymap-sym)) |
222 ;; Use `toggle' rather than (if ,mode 0 1) so that using | 222 ;; Use `toggle' rather than (if ,mode 0 1) so that using |
223 ;; repeat-command still does the toggling correctly. | 223 ;; repeat-command still does the toggling correctly. |
224 (interactive (list (or current-prefix-arg 'toggle))) | 224 (interactive (list (or current-prefix-arg 'toggle))) |
225 (setq ,mode | 225 (let ((,last-message (current-message))) |
226 (cond | 226 (setq ,mode |
227 ((eq arg 'toggle) (not ,mode)) | 227 (cond |
228 (arg (> (prefix-numeric-value arg) 0)) | 228 ((eq arg 'toggle) (not ,mode)) |
229 (t | 229 (arg (> (prefix-numeric-value arg) 0)) |
230 (if (null ,mode) t | 230 (t |
231 (message | 231 (if (null ,mode) t |
232 "Toggling %s off; better pass an explicit argument." | 232 (message |
233 ',mode) | 233 "Toggling %s off; better pass an explicit argument." |
234 nil)))) | 234 ',mode) |
235 ,@body | 235 nil)))) |
236 ;; The on/off hooks are here for backward compatibility only. | 236 ,@body |
237 (run-hooks ',hook (if ,mode ',hook-on ',hook-off)) | 237 ;; The on/off hooks are here for backward compatibility only. |
238 (if (called-interactively-p) | 238 (run-hooks ',hook (if ,mode ',hook-on ',hook-off)) |
239 (progn | 239 (if (called-interactively-p) |
240 ,(if globalp `(customize-mark-as-set ',mode)) | 240 (progn |
241 ;; Avoid overwriting a message shown by the body, | 241 ,(if globalp `(customize-mark-as-set ',mode)) |
242 ;; but do overwrite previous messages. | 242 ;; Avoid overwriting a message shown by the body, |
243 (unless ,(and (current-message) | 243 ;; but do overwrite previous messages. |
244 (not (equal last-message (current-message)))) | 244 (unless (and (current-message) |
245 (message ,(format "%s %%sabled" pretty-name) | 245 (not (equal ,last-message |
246 (if ,mode "en" "dis"))))) | 246 (current-message)))) |
247 (message ,(format "%s %%sabled" pretty-name) | |
248 (if ,mode "en" "dis")))))) | |
247 (force-mode-line-update) | 249 (force-mode-line-update) |
248 ;; Return the new setting. | 250 ;; Return the new setting. |
249 ,mode) | 251 ,mode) |
250 | 252 |
251 ;; Autoloading a define-minor-mode autoloads everything | 253 ;; Autoloading a define-minor-mode autoloads everything |
537 (put ',prev-sym 'definition-name ',base)))) | 539 (put ',prev-sym 'definition-name ',base)))) |
538 | 540 |
539 | 541 |
540 (provide 'easy-mmode) | 542 (provide 'easy-mmode) |
541 | 543 |
542 ;;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a | 544 ;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a |
543 ;;; easy-mmode.el ends here | 545 ;;; easy-mmode.el ends here |