3

Ignoring the *Messages* buffer which is used for logging messages, and which can be disabled, is there a way to get the current message displayed using Elisp?


Asking because there are times when it's impossible to use inhibit-message (because message is called from C, so I'd like to backup and restore the current message).

5

Take a look at current-message function:

(current-message)

Probably introduced at or before Emacs version 20.

Return the string currently displayed in the echo area, or nil if none.

Code

(progn
  (message "foo")
  (format "current message is %s" (current-message)))

will return "current message is foo"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.