]> git.eshelyaron.com Git - emacs.git/commitdiff
(define-minor-mode): Fix staging brain damage.
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Sep 2007 18:27:34 +0000 (18:27 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 21 Sep 2007 18:27:34 +0000 (18:27 +0000)
lisp/ChangeLog
lisp/emacs-lisp/easy-mmode.el

index c3909c0de095f8e97ff70d5d71517e6850376dc5..c0e61af4a29b6350a951e1fd353d37a2be60dc00 100644 (file)
@@ -1,3 +1,7 @@
+2007-09-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/easy-mmode.el (define-minor-mode): Fix staging brain damage.
+
 2007-09-21  Kevin Ryde  <user42@zip.com.au>
 
        * international/mule.el (sgml-html-meta-auto-coding-function):
index 80d1625ec9ba9f8a2b7e433e6d2c9350b6791b5f..d9497355fefcc15d811f1c4da8288e818f8582cd 100644 (file)
@@ -139,8 +139,8 @@ For example, you could write
     (setq body (list* lighter keymap body) lighter nil keymap nil))
    ((keywordp keymap) (push keymap body) (setq keymap nil)))
 
-  (let* ((last-message (current-message))
-        (mode-name (symbol-name mode))
+  (let* ((last-message (make-symbol "last-message"))
+         (mode-name (symbol-name mode))
         (pretty-name (easy-mmode-pretty-mode-name mode lighter))
         (globalp nil)
         (set nil)
@@ -222,28 +222,30 @@ With zero or negative ARG turn mode off.
         ;; Use `toggle' rather than (if ,mode 0 1) so that using
         ;; repeat-command still does the toggling correctly.
         (interactive (list (or current-prefix-arg 'toggle)))
-        (setq ,mode
-              (cond
-               ((eq arg 'toggle) (not ,mode))
-               (arg (> (prefix-numeric-value arg) 0))
-               (t
-                (if (null ,mode) t
-                  (message
-                   "Toggling %s off; better pass an explicit argument."
-                   ',mode)
-                  nil))))
-        ,@body
-        ;; The on/off hooks are here for backward compatibility only.
-        (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
-        (if (called-interactively-p)
-            (progn
-              ,(if globalp `(customize-mark-as-set ',mode))
-              ;; Avoid overwriting a message shown by the body,
-               ;; but do overwrite previous messages.
-              (unless  ,(and (current-message)
-                              (not (equal last-message (current-message))))
-                (message ,(format "%s %%sabled" pretty-name)
-                         (if ,mode "en" "dis")))))
+        (let ((,last-message (current-message)))
+           (setq ,mode
+                 (cond
+                  ((eq arg 'toggle) (not ,mode))
+                  (arg (> (prefix-numeric-value arg) 0))
+                  (t
+                   (if (null ,mode) t
+                     (message
+                      "Toggling %s off; better pass an explicit argument."
+                      ',mode)
+                     nil))))
+           ,@body
+           ;; The on/off hooks are here for backward compatibility only.
+           (run-hooks ',hook (if ,mode ',hook-on ',hook-off))
+           (if (called-interactively-p)
+               (progn
+                 ,(if globalp `(customize-mark-as-set ',mode))
+                 ;; Avoid overwriting a message shown by the body,
+                 ;; but do overwrite previous messages.
+                 (unless (and (current-message)
+                              (not (equal ,last-message
+                                          (current-message))))
+                   (message ,(format "%s %%sabled" pretty-name)
+                            (if ,mode "en" "dis"))))))
         (force-mode-line-update)
         ;; Return the new setting.
         ,mode)
@@ -539,5 +541,5 @@ found, do `widen' first and then call NARROWFUN with no args after moving."
 
 (provide 'easy-mmode)
 
-;;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a
+;; arch-tag: d48a5250-6961-4528-9cb0-3c9ea042a66a
 ;;; easy-mmode.el ends here