Function: mh-yank-cur-msg
mh-yank-cur-msg is an autoloaded, interactive and byte-compiled
function defined in mh-letter.el.gz.
Signature
(mh-yank-cur-msg)
Documentation
Insert the current message into the draft buffer.
It is often useful to insert a snippet of text from a letter that
someone mailed to provide some context for your reply. This
command does this by adding an attribution, yanking a portion of
text from the message to which you're replying, and inserting
mh-ins-buf-prefix (> ) before each line.
The attribution consists of the sender's name and email address
followed by the content of the option
mh-extract-from-attribution-verb.
You can also turn on the option
mh-delete-yanked-msg-window-flag to delete the window
containing the original message after yanking it to make more
room on your screen for your reply.
You can control how the message to which you are replying is
yanked into your reply using mh-yank-behavior.
If this isn't enough, you can gain full control over the
appearance of the included text by setting mail-citation-hook
to a function that modifies it. For example, if you set this hook
to trivial-cite (which is NOT part of Emacs), set
mh-yank-behavior to "Body and Header" (see URL
http://shasta.cs.uiuc.edu/~lrclause/tc.html).
Note that if mail-citation-hook is set, mh-ins-buf-prefix is
not inserted. If the option mh-yank-behavior is set to one of
the supercite flavors, the hook mail-citation-hook is ignored
and mh-ins-buf-prefix is not inserted.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-letter.el.gz
;;;###mh-autoload
(defun mh-yank-cur-msg ()
"Insert the current message into the draft buffer.
It is often useful to insert a snippet of text from a letter that
someone mailed to provide some context for your reply. This
command does this by adding an attribution, yanking a portion of
text from the message to which you're replying, and inserting
`mh-ins-buf-prefix' (`> ') before each line.
The attribution consists of the sender's name and email address
followed by the content of the option
`mh-extract-from-attribution-verb'.
You can also turn on the option
`mh-delete-yanked-msg-window-flag' to delete the window
containing the original message after yanking it to make more
room on your screen for your reply.
You can control how the message to which you are replying is
yanked into your reply using `mh-yank-behavior'.
If this isn't enough, you can gain full control over the
appearance of the included text by setting `mail-citation-hook'
to a function that modifies it. For example, if you set this hook
to `trivial-cite' (which is NOT part of Emacs), set
`mh-yank-behavior' to \"Body and Header\" (see URL
`http://shasta.cs.uiuc.edu/~lrclause/tc.html').
Note that if `mail-citation-hook' is set, `mh-ins-buf-prefix' is
not inserted. If the option `mh-yank-behavior' is set to one of
the supercite flavors, the hook `mail-citation-hook' is ignored
and `mh-ins-buf-prefix' is not inserted."
(interactive)
(let ((show-buffer))
(if (and mh-sent-from-folder
(with-current-buffer mh-sent-from-folder mh-show-buffer)
(setq show-buffer (with-current-buffer mh-sent-from-folder
(get-buffer mh-show-buffer)))
mh-sent-from-msg)
(let ((to-point (point))
(to-buffer (current-buffer)))
(if mh-delete-yanked-msg-window-flag
(with-current-buffer mh-sent-from-folder
(delete-windows-on show-buffer)))
;; Find displayed message
(with-current-buffer show-buffer
(let* ((from-attr (mh-extract-from-attribution))
(yank-region (mh-mark-active-p nil))
(mh-ins-str
(cond ((and yank-region
(or (eq 'supercite mh-yank-behavior)
(eq 'autosupercite mh-yank-behavior)
(eq t mh-yank-behavior)))
;; supercite needs the full header
(concat
(buffer-substring (point-min) (mh-mail-header-end))
"\n"
(buffer-substring (region-beginning) (region-end))))
(yank-region
(buffer-substring (region-beginning) (region-end)))
((or (eq 'body mh-yank-behavior)
(eq 'attribution mh-yank-behavior)
(eq 'autoattrib mh-yank-behavior))
(buffer-substring
(save-excursion
(goto-char (point-min))
(mh-goto-header-end 1)
(point))
(point-max)))
((or (eq 'supercite mh-yank-behavior)
(eq 'autosupercite mh-yank-behavior)
(eq t mh-yank-behavior))
(buffer-substring (point-min) (point-max)))
(t
(buffer-substring (point) (point-max))))))
(with-current-buffer to-buffer
(save-restriction
(narrow-to-region to-point to-point)
(insert (mh-filter-out-non-text mh-ins-str))
(goto-char (point-max)) ;Needed for sc-cite-original
(push-mark) ;Needed for sc-cite-original
(goto-char (point-min)) ;Needed for sc-cite-original
(mh-insert-prefix-string mh-ins-buf-prefix)
(when (or (eq 'attribution mh-yank-behavior)
(eq 'autoattrib mh-yank-behavior))
(insert from-attr)
(mh-identity-insert-attribution-verb nil)
(insert "\n\n"))
;; If the user has selected a region, he has already "edited" the
;; text, so leave the cursor at the end of the yanked text. In
;; either case, leave a mark at the opposite end of the included
;; text to make it easy to jump or delete to the other end of the
;; text.
(push-mark)
(goto-char (point-max))
(if (null yank-region)
(mh-exchange-point-and-mark-preserving-active-mark)))))))
(error "There is no current message"))))