Function: mh-reply

mh-reply is an autoloaded, interactive and byte-compiled function defined in mh-comp.el.gz.

Signature

(mh-reply MESSAGE &optional REPLY-TO INCLUDEP)

Documentation

Reply to a MESSAGE.

When you reply to a message, you are first prompted with "Reply to whom?" (unless the optional argument REPLY-TO is provided). You have several choices here.

     Response Reply Goes To

     from The person who sent the message. This is the
                  default, so <RET> is sufficient.

     to Replies to the sender, plus all recipients in the
                  "To:" header field.

     all cc Forms a reply to the addresses in the
                  "Mail-Followup-To:" header field if one
                  exists; otherwise forms a reply to the sender,
                  plus all recipients.

Depending on your answer, "repl" is given a different argument to form your reply. Specifically, a choice of "from" or none at all runs "repl -nocc all", and a choice of "to" runs "repl
-cc to". Finally, either "cc" or "all" runs "repl -cc all
-nocc me".

Two windows are then created. One window contains the message to which you are replying in an MH-Show buffer. Your draft, in MH-Letter mode (*note mh-letter-mode), is in the other window. If the reply draft was not one that you expected, check the things that affect the behavior of "repl" which include the
"repl:" profile component and the "replcomps" and
"replgroupcomps" files.

If you supply a prefix argument INCLUDEP, the message you are replying to is inserted in your reply after having first been run through "mhl" with the format file "mhl.reply".

Alternatively, you can customize the option mh-yank-behavior and choose one of its "Automatically" variants to do the same thing. If you do so, the prefix argument has no effect.

Another way to include the message automatically in your draft is to use "repl: -filter repl.filter" in your MH profile.

If you wish to customize the header or other parts of the reply draft, please see "repl" and "mh-format".

See also mh-reply-show-message-flag, mh-reply-default-reply-to, and mh-send.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-comp.el.gz
;;;###mh-autoload
(defun mh-reply (message &optional reply-to includep)
  "Reply to a MESSAGE.

When you reply to a message, you are first prompted with \"Reply
to whom?\" (unless the optional argument REPLY-TO is provided).
You have several choices here.

     Response     Reply Goes To

     from         The person who sent the message. This is the
                  default, so <RET> is sufficient.

     to           Replies to the sender, plus all recipients in the
                  \"To:\" header field.

     all cc       Forms a reply to the addresses in the
                  \"Mail-Followup-To:\" header field if one
                  exists; otherwise forms a reply to the sender,
                  plus all recipients.

Depending on your answer, \"repl\" is given a different argument
to form your reply. Specifically, a choice of \"from\" or none at
all runs \"repl -nocc all\", and a choice of \"to\" runs \"repl
-cc to\". Finally, either \"cc\" or \"all\" runs \"repl -cc all
-nocc me\".

Two windows are then created. One window contains the message to
which you are replying in an MH-Show buffer. Your draft, in
MH-Letter mode (*note `mh-letter-mode'), is in the other window.
If the reply draft was not one that you expected, check the
things that affect the behavior of \"repl\" which include the
\"repl:\" profile component and the \"replcomps\" and
\"replgroupcomps\" files.

If you supply a prefix argument INCLUDEP, the message you are
replying to is inserted in your reply after having first been run
through \"mhl\" with the format file \"mhl.reply\".

Alternatively, you can customize the option `mh-yank-behavior'
and choose one of its \"Automatically\" variants to do the same
thing. If you do so, the prefix argument has no effect.

Another way to include the message automatically in your draft is
to use \"repl: -filter repl.filter\" in your MH profile.

If you wish to customize the header or other parts of the reply
draft, please see \"repl\" and \"mh-format\".

See also `mh-reply-show-message-flag',
`mh-reply-default-reply-to', and `mh-send'."
  (interactive (list
                (mh-get-msg-num t)
                (let ((minibuffer-help-form
                       "from => Sender only\nto => Sender and primary recipients\ncc or all => Sender and all recipients"))
                  (or mh-reply-default-reply-to
                      (completing-read "Reply to whom (default from): "
                                       '(("from") ("to") ("cc") ("all"))
                                       nil
                                       t)))
                current-prefix-arg))
  (let* ((folder mh-current-folder)
         (show-buffer mh-show-buffer)
         (config (current-window-configuration))
         (group-reply (or (equal reply-to "cc") (equal reply-to "all")))
         (form-file (cond ((and (mh-variant-p 'nmh 'gnu-mh) group-reply
                                (stringp mh-repl-group-formfile))
                           mh-repl-group-formfile)
                          ((stringp mh-repl-formfile) mh-repl-formfile)
                          (t nil))))
    (message "Composing a reply...")
    (mh-exec-cmd "repl" "-build" "-noquery" "-nodraftfolder"
                 (if form-file
                     (list "-form" form-file))
                 mh-current-folder message
                 (cond ((or (equal reply-to "from") (equal reply-to ""))
                        '("-nocc" "all"))
                       ((equal reply-to "to")
                        '("-cc" "to"))
                       (group-reply (if (mh-variant-p 'nmh 'gnu-mh)
                                        '("-group" "-nocc" "me")
                                      '("-cc" "all" "-nocc" "me"))))
                 (cond ((or (eq mh-yank-behavior 'autosupercite)
                            (eq mh-yank-behavior 'autoattrib))
                        '("-noformat"))
                       (includep '("-filter" "mhl.reply"))
                       (t '())))
    (let ((draft (mh-read-draft "reply"
                                (expand-file-name "reply" mh-user-path)
                                t)))
      (delete-other-windows)
      (save-buffer)

      (let ((to (mh-get-header-field "To:"))
            (subject (mh-get-header-field "Subject:"))
            (cc (mh-get-header-field "Cc:")))
        (goto-char (point-min))
        (mh-goto-header-end 1)
        (or includep
            (not mh-reply-show-message-flag)
            (mh-in-show-buffer (show-buffer)
              (mh-display-msg message folder)))
        (mh-add-msgs-to-seq message 'answered t)
        (message "Composing a reply...done")
        (mh-compose-and-send-mail draft "" folder message to subject cc
                                  mh-note-repl "Replied:" config))
      (when (and (or (eq 'autosupercite mh-yank-behavior)
                     (eq 'autoattrib mh-yank-behavior))
                 (eq (mh-show-buffer-message-number) mh-sent-from-msg))
        (undo-boundary)
        (mh-yank-cur-msg))
      (mh-letter-mode-message))))