# Is there a way to read the current displayed message?

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).

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"