changeset 24000:2de7db40964d

(with-temp-message): Don't display MESSAGE if nil.
author Simon Marshall <simon@gnu.org>
date Wed, 06 Jan 1999 10:05:50 +0000
parents 8c46e3a0623e
children fce0e760c4ab
files lisp/subr.el
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Wed Jan 06 08:40:50 1999 +0000
+++ b/lisp/subr.el	Wed Jan 06 10:05:50 1999 +0000
@@ -964,13 +964,18 @@
 The original message is restored to the echo area after BODY has finished.
 The value returned is the value of the last form in BODY.
 MESSAGE is written to the message log buffer if `message-log-max' is non-nil."
-  (let ((current-message (make-symbol "current-message")))
-    `(let ((,current-message (current-message)))
+  (let ((current-message (make-symbol "current-message"))
+	(temp-message (make-symbol "with-temp-message")))
+    `(let ((,temp-message ,message)
+	   (,current-message))
        (unwind-protect
 	   (progn
-	     (message ,message)
+	     (when ,temp-message
+	       (setq ,current-message (current-message))
+	       (message ,temp-message))
 	     ,@body)
-	 (message ,current-message)))))
+	 (when ,temp-message
+	   (message ,current-message))))))
 
 (defmacro with-temp-buffer (&rest body)
   "Create a temporary buffer, and evaluate BODY there like `progn'.