Function: mail-yank-original

mail-yank-original is an interactive and byte-compiled function defined in sendmail.el.gz.

Signature

(mail-yank-original ARG)

Documentation

Insert the message being replied to, if any (in Rmail).

Puts point after the text and mark before. Normally, indents each nonblank line ARG spaces (default 3). However, if mail-yank-prefix is non-nil, insert that prefix on each line.

Just C-u (universal-argument) as argument means don't indent, insert no prefix, and don't delete any header fields.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mail/sendmail.el.gz
(defun mail-yank-original (arg)
  "Insert the message being replied to, if any (in Rmail).
Puts point after the text and mark before.
Normally, indents each nonblank line ARG spaces (default 3).
However, if `mail-yank-prefix' is non-nil, insert that prefix on each line.

Just \\[universal-argument] as argument means don't indent, insert no prefix,
and don't delete any header fields."
  (interactive "P")
  (if mail-reply-action
      (let ((start (point))
	    (original mail-reply-action)
	    (omark (mark t)))
	(and (consp original) (eq (car original) 'insert-buffer)
	     (setq original (nth 1 original)))
	(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)))
	  ;; If the original message is in another window in the same
	  ;; frame, delete that window to save space.
	  (delete-windows-on original t)
	  (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))
	(if (consp arg)
	    nil
	  (goto-char start)
	  (let ((mail-indentation-spaces (if arg (prefix-numeric-value arg)
					   mail-indentation-spaces))
		;; Avoid error in Transient Mark mode
		;; on account of mark's being inactive.
		(mark-even-if-inactive t))
	    (cond (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)))
		  (t
		   (mail-indent-citation)))))
	;; 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))))
	(if (not (eolp)) (insert ?\n)))))