Function: mail-yank-original
mail-yank-original is an interactive and byte-compiled function
defined in hsmail.el.
Signature
(mail-yank-original ARG)
Documentation
Insert the message being replied to, if any (in Rmail).
Put point before the text and mark after.
Normally indent each nonblank line ARG spaces (default 3).
However, if `mail-yank-prefix’ is non-nil, insert that prefix
on each line when mail-indent-citation is called.
Apply mail-citation-hook, mail-yank-hook or mail-yank-hooks
to text (in decreasing order of precedence).
Just C-u (universal-argument) as argument means don't indent,
insert no prefix, and don't delete any header fields.
If supercite is in use, header fields are never deleted. Use (setq sc-nuke-mail-headers 'all) to have them removed.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hsmail.el
;; Redefine this function from "sendmail.el" to include Hyperbole button
;; data when yanking in a message and to highlight buttons if possible.
(defun mail-yank-original (arg)
"Insert the message being replied to, if any (in Rmail).
Put point before the text and mark after.
Normally indent each nonblank line ARG spaces (default 3).
However, if `mail-yank-prefix’ is non-nil, insert that prefix
on each line when `mail-indent-citation' is called.
Apply `mail-citation-hook', `mail-yank-hook' or `mail-yank-hooks'
to text (in decreasing order of precedence).
Just \\[universal-argument] as argument means don't indent,
insert no prefix, and don't delete any header fields.
If supercite is in use, header fields are never deleted.
Use (setq sc-nuke-mail-headers \\='all) to have them removed."
(interactive "P")
(if mail-reply-action
(let ((start (point))
(original mail-reply-action)
(opoint (point))
(omark (mark t)))
(and (consp original) (eq (car original) 'insert-buffer)
(setq original (nth 1 original)))
(unwind-protect
(progn
(if (consp original)
(progn
;; Call yank function, and set the mark if it doesn't.
(apply (car original) (cdr original))
(if (eq omark (mark t))
(push-mark (point))))
;; If the original message is in another window in the same
;; frame, delete that window to save space.
(delete-windows-on original t)
(with-current-buffer original
;; Hyperbole addition: Might be called from newsreader
;; before any Hyperbole mail reader support has been autoloaded.
(cond ((fboundp 'rmail:msg-widen) (rmail:msg-widen))
((eq major-mode 'news-reply-mode) (widen))))
(with-no-warnings
;; We really want this to set mark.
(insert-buffer original)
;; If they yank the original text, the encoding of the
;; original message is a better default than
;; the default buffer-file-coding-system.
(and (coding-system-equal
(default-value 'buffer-file-coding-system)
buffer-file-coding-system)
(setq buffer-file-coding-system
(coding-system-change-text-conversion
buffer-file-coding-system
(coding-system-base
(with-current-buffer original
buffer-file-coding-system))))))
(set-text-properties (point) (mark t) nil))
;; Hyperbole addition
(hmail:msg-narrow)
(when (fboundp 'hproperty:but-create)
(hproperty:but-create))
(unless (consp arg)
;; Don't ever remove headers if user uses Supercite package,
;; since he can set an option in that package to do
;; the removal.
(or (hypb:supercite-p)
(mail-yank-clear-headers
start (marker-position (mark-marker))))
(goto-char start)
(let ((mail-indentation-spaces (if arg (prefix-numeric-value arg)
mail-indentation-spaces))
;; Avoid error in Transient Mark mode when the
;; mark is inactive.
(mark-even-if-inactive t))
(cond ((and (boundp 'mail-citation-hook) mail-citation-hook)
;; Bind mail-citation-header to the inserted message's header.
(let ((mail-citation-header
(buffer-substring-no-properties
start
(save-excursion
(save-restriction
(narrow-to-region start (point-max))
(goto-char start)
(rfc822-goto-eoh)
(point))))))
(run-hooks 'mail-citation-hook)))
((and (boundp 'mail-yank-hook) mail-yank-hook)
(run-hooks 'mail-yank-hook))
((and (boundp 'mail-yank-hooks) mail-yank-hooks)
(run-hooks 'mail-yank-hooks))
(t (mail-indent-citation))))
(goto-char (min (point-max) (mark t)))
(set-mark opoint)
(delete-region (point) ; Remove trailing blank lines.
(progn (re-search-backward "[^ \t\n\r\f]")
(end-of-line)
(point))))
(unless (eq major-mode 'news-reply-mode)
;; This is like exchange-point-and-mark, but doesn't activate the mark.
;; It is cleaner to avoid activation, even though the command
;; loop would deactivate the mark because we inserted text.
(goto-char (prog1 (mark t)
(set-marker (mark-marker)
(point) (current-buffer))))
(unless (eolp)
(insert ?\n))))
;; Hyperbole addition
(hmail:msg-narrow)))))