Go backward to Using the Mouse. Go up to Top.

Hooks
*****

VM has many hook variables that allow you to run functions when
certain events occur.  Here is a list of the hooks and when they are
run.  (If you don't write Emacs-Lisp programs you can skip this
chapter.)

`vm-select-new-message-hook'
     List of hook functions called every time a message with the "new"
     attribute is made to be the current message.  When the hooks are
     run the current buffer will be the folder containing the message
     and the start and end of the message will be bracketed by
     (point-min) and (point-max).

`vm-select-unread-message-hook'
     List of hook functions called every time a message with the
     "unread" attribute is made to be the current message.  When the
     hooks are run the current buffer will be the folder containing
     the message and the start and end of the message will be
     bracketed by (point-min) and (point-max).

`vm-select-message-hook'
     List of hook functions called every time a message is made to be
     the current message.  When the hooks are run the current buffer
     will be the folder containing the message and the start and end
     of the message will be bracketed by (point-min) and (point-max).

`vm-arrived-message-hook'
     List of hook functions called once for each message gathered from
     the system mail spool, or from another folder with
     `vm-get-new-mail', or from a digest with `vm-burst-digest'.  When
     the hooks are run the current buffer will be the folder
     containing the message and the start and end of the message will
     be bracketed by (point-min) and (point-max).

`vm-spooled-mail-waiting-hook'
     List of functions called when VM first notices mail is spooled
     for a folder.  The folder buffer will be current when the hooks
     are run.

`vm-arrived-messages-hook'
     List of hook functions called after VM has gathered a group of
     messages from the system mail spool, or from another folder with
     `vm-get-new-mail', or from a digest with `vm-burst-digest'.  When
     the hooks are run, the new messages will have already been added
     to the message list but may not yet appear in the summary.  When
     the hooks are run the current buffer will be the folder
     containing the messages.

`vm-reply-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created for a reply.  VM runs this hook and then
     runs `vm-mail-mode-hook' before leaving you in the Mail mode
     buffer.

`vm-forward-message-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created to forward a message.  VM runs this hook
     and then runs `vm-mail-mode-hook' before leaving the user in the
     Mail mode buffer.

`vm-resend-bounced-message-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created to resend a bounced message.  VM runs
     this hook and then runs `vm-mail-mode-hook' before leaving you in
     the Mail mode buffer.

`vm-resend-message-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created to resend a message.  VM runs this hook
     and then runs `vm-mail-mode-hook' before leaving you in the Mail
     mode buffer.

`vm-send-digest-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created to send a digest.  VM runs this hook and
     then runs `m-mail-mode-hook' before leaving you in the Mail mode
     buffer.

`vm-mail-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created to send a non specialized message, i.e. a
     message that is not a reply, forward, digest, etc.  VM runs this
     hook and then runs `vm-mail-mode-hook' before leaving you in the
     Mail mode buffer.

`vm-summary-update-hook'
     List of hook functions called just after VM updates an existing
     entry a folder summary.

`vm-summary-redo-hook'
     List of hook functions called just after VM adds or deletes
     entries from a folder summary.

`vm-visit-folder-hook'
     List of hook functions called just after VM visits a folder.  It
     doesn't matter if the folder buffer already exists, this hook is
     run each time `vm' or `vm-visit-folder' is called interactively.
     It is *not* run after `vm-mode' is called.

`vm-retrieved-spooled-mail-hook'
     List of hook functions called just after VM has retrieved a group
     of messages from your system mailbox(es).  When these hooks are
     run, the messages have been added to the folder buffer but not
     the message list or summary.  When the hooks are run, the current
     buffer will be the folder where the messages were incorporated.

`vm-edit-message-hook'
     List of hook functions to be run just before a message is edited.
     This is the last thing `vm-edit-message' does before leaving you
     in the edit buffer.

`vm-mail-mode-hook'
     List of hook functions to be run after a Mail mode composition
     buffer has been created.  This is the last thing VM does before
     leaving you in the Mail mode buffer.

`vm-mode-hook'
     List of hook functions to run when a buffer enters `vm-mode'.
     These hook functions should generally be used to set key bindings
     and local variables.

`vm-mode-hooks'
     Old name for `vm-mode-hook'.  Supported for backward
     compatibility.  You should use the new name.

`vm-summary-mode-hook'
     List of hook functions to run when a VM summary buffer is
     created.  The current buffer will be that buffer when the hooks
     are run.

`vm-summary-mode-hooks'
     Old name for `vm-summary-mode-hook'.  Supported for backward
     compatibility.  You should use the new name.

`vm-virtual-mode-hook'
     List of hook functions to run when a VM virtual folder buffer is
     created.  The current buffer will be that buffer when the hooks
     are run.

`vm-presentation-mode-hook'
     List of hook functions to run when a VM presentation buffer is
     created.  The current buffer will be that buffer when the hooks
     are run.  Presentation buffers are used to display messages when
     some type of decoding must be done to the message to make it
     presentable.  E.g. MIME decoding.

`vm-quit-hook'
     List of hook functions to run when you quit VM.  This applies to
     any VM quit command.

`vm-summary-pointer-update-hook'
     List of hook functions to run when VM summary pointer is updated.
     When the hooks are run, the current buffer will be the summary
     buffer.

`vm-display-buffer-hook'
     List of hook functions that are run every time VM wants to
     display a buffer.  When the hooks are run the current buffer will
     be the buffer that VM wants to display.  The hooks are expected
     to select a window and VM will display the buffer in that window.

     If you use display hooks, you should not use VM's builtin window
     configuration system as the result is likely to be confusing.

`vm-undisplay-buffer-hook'
     List of hook functions that are run every time VM wants to remove
     a buffer from the display.  When the hooks are run the current
     buffer will be the buffer that VM wants to disappear.  The hooks
     are expected to do the work of removing the buffer from the
     display.  The hook functions should not kill the buffer.

     If you use undisplay hooks, you should not use VM's builtin
     window configuration system as the result is likely to be
     confusing.

`vm-iconify-frame-hook'
     List of hook functions that are run whenever VM iconifies a
     frame.

`vm-menu-setup-hook'
     List of hook functions that are run just after all menus are
     initialized.

`vm-mime-display-function'
     If non-`nil', this should name a function to be called inside
     `vm-decode-mime-message' to do the MIME display the current
     message.  The function is called with no arguments, and at the
     time of the call the current buffer will be the "presentation
     buffer" for the folder, which is a temporary buffer that VM uses
     for the display of MIME messages.  A copy of the current message
     will be in the presentation buffer at that time.  The normal work
     that `vm-decode-mime-message' would do is not done, because this
     function is expected to subsume all of it.

`mail-yank-hooks'
     Hooks called after a message is yanked into a mail composition.

     (This hook is deprecated, you should use mail-citation-hook
     instead.)

     Value is a list of functions to be run.  Each hook function can
     find the newly yanked message between point and mark.  Each hook
     function should return with point and mark around the yanked
     message.

     See the documentation for `vm-yank-message' to see when VM will
     run these hooks.

`mail-citation-hook'
     Hook for modifying a citation just inserted in the mail buffer.
     Each hook function can find the citation between (point) and
     (mark t).  And each hook function should leave point and mark
     around the citation text as modified.

     If this hook is entirely empty, i.e. `nil', a default action is
     taken instead of no action.