Variable: mh-letter-mode-hook

mh-letter-mode-hook is a customizable variable defined in mh-letter.el.gz.

Value

(smail:comment-add)

Documentation

Hook run by mh-letter-mode on a new letter.

This hook allows you to do some processing before editing a letter. For example, you may wish to modify the header after
"repl" has done its work, or you may have a complicated
"components" file and need to tell MH-E where the cursor should
go.

This variable was added, or its default value changed, in MH-E version
6.0.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-letter.el.gz
;;;###mh-autoload
(define-derived-mode mh-letter-mode mail-mode "MH-Letter"
  "Mode for composing letters in MH-E\\<mh-letter-mode-map>.

When you have finished composing, type \\[mh-send-letter] to send
the message using the MH mail handling system.

There are two types of tags used by MH-E when composing MIME
messages: MML and MH. The option `mh-compose-insertion' controls
what type of tags are inserted by MH-E commands. These tags can
be converted to MIME body parts by running \\[mh-mh-to-mime] for
MH-style directives or \\[mh-mml-to-mime] for MML tags.

Options that control this mode can be changed with
\\[customize-group]; specify the \"mh-compose\" group.

When a message is composed, the hooks `text-mode-hook',
`mail-mode-hook', and `mh-letter-mode-hook' are run (in that
order).

\\{mh-letter-mode-map}"
  (mh-find-path)
  (make-local-variable 'mh-send-args)
  (make-local-variable 'mh-annotate-char)
  (make-local-variable 'mh-annotate-field)
  (make-local-variable 'mh-previous-window-config)
  (make-local-variable 'mh-sent-from-folder)
  (make-local-variable 'mh-sent-from-msg)
  (unless mh-letter-tool-bar-map
    (mh-tool-bar-letter-buttons-init))
  (if (boundp 'tool-bar-map)
      (setq-local tool-bar-map mh-letter-tool-bar-map))
  ;; Set the local value of mh-mail-header-separator according to what is
  ;; present in the buffer...
  (setq-local mh-mail-header-separator
              (save-excursion
                (goto-char (mh-mail-header-end))
                (buffer-substring-no-properties (point) (line-end-position))))
  (make-local-variable 'mail-header-separator)
  (setq mail-header-separator mh-mail-header-separator) ;override sendmail.el
  (mh-set-help mh-letter-mode-help-messages)
  (setq buffer-invisibility-spec '((vanish . t) t))
  (setq-local line-move-ignore-invisible t)

  ;; Enable undo since a show-mode buffer might have been reused.
  (buffer-enable-undo)
  (make-local-variable 'font-lock-defaults)
  (cond
   ((or (equal mh-highlight-citation-style 'font-lock)
        (equal mh-highlight-citation-style 'gnus))
    ;; Let's use font-lock even if gnus is used in show-mode.  The reason
    ;; is that gnus uses static text properties which are not appropriate
    ;; for a buffer that will be edited.  So the choice here is either fontify
    ;; the citations and header...
    (setq font-lock-defaults '(mh-letter-font-lock-keywords t)))
   (t
    ;; ...or the header only
    (setq font-lock-defaults '((mh-show-font-lock-keywords) t))))
  ;; Maybe we want to use the existing Mail menu from mail-mode in
  ;; 9.0; in the mean time, let's remove it since the redundancy will
  ;; only produce confusion.
  (define-key mh-letter-mode-map [menu-bar mail] #'undefined)
  (setq fill-column mh-letter-fill-column)
  (add-hook 'completion-at-point-functions
            #'mh-letter-completion-at-point nil 'local)
  ;; If text-mode-hook turned on auto-fill, tune it for messages
  (when auto-fill-function
    (make-local-variable 'auto-fill-function)
    (setq auto-fill-function #'mh-auto-fill-for-letter)))