Mercurial > emacs
comparison lisp/subr.el @ 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 | 2cd294915abd |
children | f36caedebd5f |
comparison
equal
deleted
inserted
replaced
23999:8c46e3a0623e | 24000:2de7db40964d |
---|---|
962 (defmacro with-temp-message (message &rest body) | 962 (defmacro with-temp-message (message &rest body) |
963 "Display MESSAGE temporarily while BODY is evaluated. | 963 "Display MESSAGE temporarily while BODY is evaluated. |
964 The original message is restored to the echo area after BODY has finished. | 964 The original message is restored to the echo area after BODY has finished. |
965 The value returned is the value of the last form in BODY. | 965 The value returned is the value of the last form in BODY. |
966 MESSAGE is written to the message log buffer if `message-log-max' is non-nil." | 966 MESSAGE is written to the message log buffer if `message-log-max' is non-nil." |
967 (let ((current-message (make-symbol "current-message"))) | 967 (let ((current-message (make-symbol "current-message")) |
968 `(let ((,current-message (current-message))) | 968 (temp-message (make-symbol "with-temp-message"))) |
969 `(let ((,temp-message ,message) | |
970 (,current-message)) | |
969 (unwind-protect | 971 (unwind-protect |
970 (progn | 972 (progn |
971 (message ,message) | 973 (when ,temp-message |
974 (setq ,current-message (current-message)) | |
975 (message ,temp-message)) | |
972 ,@body) | 976 ,@body) |
973 (message ,current-message))))) | 977 (when ,temp-message |
978 (message ,current-message)))))) | |
974 | 979 |
975 (defmacro with-temp-buffer (&rest body) | 980 (defmacro with-temp-buffer (&rest body) |
976 "Create a temporary buffer, and evaluate BODY there like `progn'. | 981 "Create a temporary buffer, and evaluate BODY there like `progn'. |
977 See also `with-temp-file' and `with-output-to-string'." | 982 See also `with-temp-file' and `with-output-to-string'." |
978 (let ((temp-buffer (make-symbol "temp-buffer"))) | 983 (let ((temp-buffer (make-symbol "temp-buffer"))) |