Is it possible to display a message in the echo area without logging it in buffer *Messages*
?
2 Answers
Bind message-log-max
to nil
:
(defun foo ()
(interactive)
(let ((message-log-max nil))
(message "EEEEEEEEEEEEEEEEEE")))
M-x foo RET
[P.S. Don't be misled by tests using things such as M-: (let ((message-log-max nil)) (message "EEEEEEEEEEEEEEEEEE"))
into thinking that the EEEEEEEEEEEEEEEEEE
from evaluating the let
sexp is the message that was output by message
. It is instead the value returned by that evaluation. message
does not log anything to *Messages*
if message-log-max
is nil
.]
I couldn't find a built in way to do it, so I hacked this weird function:
(defun echo-and-ignore-message-buffer (message)
(let ((prev-msg-log-max message-log-max))
(unwind-protect
(progn (setq message-log-max nil)
(message message))
(setq message-log-max prev-msg-log-max))))
Check out the documentation for message-log-max
.
-
Sorry Renan, Drew was the first to post the answer (less that 1 minute before you). Thank you for the answer :-)– syl20bnrNov 5, 2014 at 4:41