aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier2007-09-21 18:27:34 +0000
committerStefan Monnier2007-09-21 18:27:34 +0000
commitdae157b7c9970d6c3ff419c8dd0601ffaca536b4 (patch)
tree1b1b8a0424b44f3f8581523fd0d2f18f3eeed4a9 /lisp
parente243eb1f503d278c460c4d00ac1ae85c0476fe46 (diff)
downloademacs-dae157b7c9970d6c3ff419c8dd0601ffaca536b4.tar.gz
emacs-dae157b7c9970d6c3ff419c8dd0601ffaca536b4.zip
(define-minor-mode): Fix staging brain damage.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/easy-mmode.el52
2 files changed, 31 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c3909c0de09..c0e61af4a29 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12007-09-21 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * emacs-lisp/easy-mmode.el (define-minor-mode): Fix staging brain damage.
4
12007-09-21 Kevin Ryde <user42@zip.com.au> 52007-09-21 Kevin Ryde <user42@zip.com.au>
2 6
3 * international/mule.el (sgml-html-meta-auto-coding-function): 7 * international/mule.el (sgml-html-meta-auto-coding-function):
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 80d1625ec9b..d9497355fef 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -139,8 +139,8 @@ For example, you could write
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)
@@ -222,28 +222,30 @@ With zero or negative ARG turn mode off.
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)
@@ -539,5 +541,5 @@ found, do `widen' first and then call NARROWFUN with no args after moving."
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