Message 5.7 Manual. Node: Message Actions

PREVMessage Buffers UPVariables next

3.9: Message Actions

When Message is being used from a news/mail reader, the reader is likely to want to perform some task after the message has been sent. Perhaps return to the previous window configuration or mark an article as replied.

The user may exit from the message buffer in various ways. The most common is C-c C-c, which sends the message and exits. Other possibilities are C-c C-s which just sends the message, C-c C-d which postpones the message editing and buries the message buffer, and C-c C-k which kills the message buffer. Each of these actions have lists associated with them that contains actions to be executed: message-send-actions, message-exit-actions, message-postpone-actions, and message-kill-actions.

Message provides a function to interface with these lists: message-add-action. The first parameter is the action to be added, and the rest of the arguments are which lists to add this action to. Here's an example from Gnus:

  (message-add-action
   `(set-window-configuration ,(current-window-configuration))
   'exit 'postpone 'kill)

This restores the Gnus window configuration when the message buffer is killed, postponed or exited.

An action can be either: a normal function, or a list where the car is a function and the cdr is the list of arguments, or a form to be evaled.

PREVMessage Buffers UPVariables next