changeset 70527:4fc3abab0f17

(define-minor-mode): Only preserve messages output during execution of the body.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 08 May 2006 15:12:25 +0000
parents 0c5d2102f71a
children c8171c0fa382
files lisp/emacs-lisp/easy-mmode.el
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/easy-mmode.el	Mon May 08 10:26:30 2006 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el	Mon May 08 15:12:25 2006 +0000
@@ -139,7 +139,8 @@
     (setq body (list* lighter keymap body) lighter nil keymap nil))
    ((keywordp keymap) (push keymap body) (setq keymap nil)))
 
-  (let* ((mode-name (symbol-name mode))
+  (let* ((last-message (current-message))
+	 (mode-name (symbol-name mode))
 	 (pretty-name (easy-mmode-pretty-mode-name mode lighter))
 	 (globalp nil)
 	 (set nil)
@@ -236,7 +237,10 @@
 	 (if (called-interactively-p)
 	     (progn
 	       ,(if globalp `(customize-mark-as-set ',mode))
-	       (unless (current-message)
+	       ;; 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)