elisp: Delayed Warnings
37.5.4 Delayed Warnings
-----------------------
Sometimes, you may wish to avoid showing a warning while a command is
running, and only show it only after the end of the command. You can
use the variable ‘delayed-warnings-list’ for this.
-- Variable: delayed-warnings-list
The value of this variable is a list of warnings to be displayed
after the current command has finished. Each element must be a
list
(TYPE MESSAGE [LEVEL [BUFFER-NAME]])
with the same form, and the same meanings, as the argument list of
‘display-warning’ (Warning Basics). Immediately after
running ‘post-command-hook’ (Command Overview), the Emacs
command loop displays all the warnings specified by this variable,
then resets it to ‘nil’.
Programs which need to further customize the delayed warnings
mechanism can change the variable ‘delayed-warnings-hook’:
-- Variable: delayed-warnings-hook
This is a normal hook which is run by the Emacs command loop, after
‘post-command-hook’, in order to to process and display delayed
warnings.
Its default value is a list of two functions:
(collapse-delayed-warnings display-delayed-warnings)
The function ‘collapse-delayed-warnings’ removes repeated entries
from ‘delayed-warnings-list’. The function
‘display-delayed-warnings’ calls ‘display-warning’ on each of the
entries in ‘delayed-warnings-list’, in turn, and then sets
‘delayed-warnings-list’ to ‘nil’.