Next: , Previous: Insertion Variables, Up: Variables

3.7 Various Message Variables

message-default-charset
Symbol naming a MIME charset. Non-ASCII characters in messages are assumed to be encoded using this charset. The default is iso-8859-1 on non-mule Emacsen; otherwise nil, which means ask the user. (This variable is used only on non-mule Emacsen.) See Charset Translation, for details on the mule-to-MIME translation process.
message-fill-column
Local value for the column beyond which automatic line-wrapping should happen for message buffers. If non-nil (the default), also turn on auto-fill in message buffers.
message-signature-separator
Regexp matching the signature separator. It is ‘^-- *$’ by default.
mail-header-separator
String used to separate the headers from the body. It is ‘--text follows this line--’ by default.
message-directory
Directory used by many mailish things. The default is ~/Mail/. All other mail file variables are derived from message-directory.
message-auto-save-directory
Directory where Message auto-saves buffers if Gnus isn't running. If nil, Message won't auto-save. The default is ~/Mail/drafts/.
message-signature-setup-hook
Hook run when initializing the message buffer. It is run after the headers have been inserted but before the signature has been inserted.
message-setup-hook
Hook run as the last thing when the message buffer has been initialized, but before yanked text is inserted.
message-header-setup-hook
Hook called narrowed to the headers after initializing the headers.

For instance, if you're running Gnus and wish to insert a ‘Mail-Copies-To’ header in all your news articles and all messages you send to mailing lists, you could do something like the following:

          (defun my-message-header-setup-hook ()
            (let ((group (or gnus-newsgroup-name "")))
              (when (or (message-fetch-field "newsgroups")
                        (gnus-group-find-parameter group 'to-address)
                        (gnus-group-find-parameter group 'to-list))
                (insert "Mail-Copies-To: never\n"))))
          
          (add-hook 'message-header-setup-hook
                    'my-message-header-setup-hook)

message-send-hook
Hook run before sending messages.

If you want to add certain headers before sending, you can use the message-add-header function in this hook. For instance:

          (add-hook 'message-send-hook 'my-message-add-content)
          (defun my-message-add-content ()
            (message-add-header "X-In-No-Sense: Nonsense")
            (message-add-header "X-Whatever: no"))

This function won't add the header if the header is already present.

message-send-mail-hook
Hook run before sending mail messages. This hook is run very late: just before the message is actually sent as mail.
message-send-news-hook
Hook run before sending news messages. This hook is run very late: just before the message is actually sent as news.
message-sent-hook
Hook run after sending messages.
message-cancel-hook
Hook run when canceling news articles.
message-mode-syntax-table
Syntax table used in message mode buffers.
message-cite-articles-with-x-no-archive
If non-nil, don't strip quoted text from articles that have ‘X-No-Archive’ set. Even if this variable isn't set, you can undo the stripping by hitting the undo keystroke.
message-strip-special-text-properties
Emacs has a number of special text properties which can break message composing in various ways. If this option is set, message will strip these properties from the message composition buffer. However, some packages requires these properties to be present in order to work. If you use one of these packages, turn this option off, and hope the message composition doesn't break too bad.
message-send-method-alist
Alist of ways to send outgoing messages. Each element has the form:
          (type predicate function)
type
A symbol that names the method.
predicate
A function called without any parameters to determine whether the message is a message of type type. The function will be called in the buffer where the message is.
function
A function to be called if predicate returns non-nil. function is called with one parameter—the prefix.

The default is:

          ((news message-news-p message-send-via-news)
           (mail message-mail-p message-send-via-mail))

The message-news-p function returns non-nil if the message looks like news, and the message-send-via-news function sends the message according to the message-send-news-function variable (see News Variables). The message-mail-p function returns non-nil if the message looks like mail, and the message-send-via-mail function sends the message according to the message-send-mail-function variable (see Mail Variables).

All the elements in this alist will be tried in order, so a message containing both a valid ‘Newsgroups’ header and a valid ‘To’ header, for example, will be sent as news, and then as mail.