Mercurial > emacs
changeset 22990:491a97002c82
(mail-citation-header): New variable.
(mail-yank-original, mail-yank-region): Bind mail-citation-header.
(mail-citation-hook): Doc fix.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 10 Aug 1998 07:43:08 +0000 |
parents | c7c48ac2e34b |
children | 313091cd2751 |
files | lisp/mail/sendmail.el |
diffstat | 1 files changed, 32 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mail/sendmail.el Mon Aug 10 07:22:21 1998 +0000 +++ b/lisp/mail/sendmail.el Mon Aug 10 07:43:08 1998 +0000 @@ -164,15 +164,22 @@ (defcustom mail-citation-hook nil "*Hook for modifying a citation just inserted in the mail buffer. -Each hook function can find the citation between (point) and (mark t). -And each hook function should leave point and mark around the citation -text as modified. +Each hook function can find the citation between (point) and (mark t), +and should leave point and mark around the citation text as modified. +The hook functions can find the header of the cited message +in the variable `mail-citation-header', whether or not this is included +in the cited portion of the message. If this hook is entirely empty (nil), a default action is taken instead of no action." :type 'hook :group 'sendmail) +(defvar mail-citation-header nil + "While running `mail-citation-hook', this variable holds the message header. +This enables the hook functions to see the whole message header +regardless of what part of it (if any) is included in the cited text.") + (defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*" "*Regular expression to match a citation prefix plus whitespace. It should match whatever sort of citation prefixes you want to handle, @@ -1187,7 +1194,17 @@ ;; on account of mark's being inactive. (mark-even-if-inactive t)) (if mail-citation-hook - (run-hooks 'mail-citation-hook) + ;; Bind mail-citation-hook 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)) (if mail-yank-hooks (run-hooks 'mail-yank-hooks) (mail-indent-citation))))) @@ -1235,7 +1252,7 @@ (mark-even-if-inactive t)) ;; Insert the citation text. (insert (with-current-buffer buffer - (buffer-substring (point) (mark)))) + (buffer-substring-no-properties (point) (mark)))) (push-mark start) ;; Indent or otherwise annotate the citation text. (if (consp arg) @@ -1243,7 +1260,16 @@ (let ((mail-indentation-spaces (if arg (prefix-numeric-value arg) mail-indentation-spaces))) (if mail-citation-hook - (run-hooks 'mail-citation-hook) + ;; Bind mail-citation-hook to the original message's header. + (let ((mail-citation-header + (with-current-buffer buffer + (buffer-substring-no-properties + (point-min) + (save-excursion + (goto-char (point-min)) + (rfc822-goto-eoh) + (point)))))) + (run-hooks 'mail-citation-hook)) (if mail-yank-hooks (run-hooks 'mail-yank-hooks) (mail-indent-citation))))))))