Variable: set-message-function
set-message-function is a variable defined in xdisp.c.
Value
set-minibuffer-message
Documentation
If non-nil, function to handle display of echo-area messages.
The function is called with one argument that is the text of a message. If this function returns nil, the message is displayed in the echo area as usual. If the function returns a string, the returned string is displayed in the echo area. If this function returns any other non-nil value, this means that the message was already handled, and the original message text will not be displayed in the echo area.
Also see clear-message-function (which can be used to clear the
message displayed by this function), and command-error-function
(which controls how error messages are displayed).
Probably introduced at or before Emacs version 27.1.
Source Code
// Defined in /usr/src/emacs/src/xdisp.c
DEFVAR_LISP ("set-message-function", Vset_message_function,
doc: /* If non-nil, function to handle display of echo-area messages.
The function is called with one argument that is the text of a message.
If this function returns nil, the message is displayed in the echo area
as usual. If the function returns a string, the returned string is
displayed in the echo area. If this function returns any other non-nil
value, this means that the message was already handled, and the original
message text will not be displayed in the echo area.
Also see `clear-message-function' (which can be used to clear the
message displayed by this function), and `command-error-function'
(which controls how error messages are displayed). */);