aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-08-10 07:43:08 +0000
committerRichard M. Stallman1998-08-10 07:43:08 +0000
commitd6bccf099ec4460b766b7041a9fb16d489ac795c (patch)
tree0be8ad19eba62b9a3cc130c3ef7d6e40db6365f0
parente43d17d3986a0352911bb56fba8298aaa84541c7 (diff)
downloademacs-d6bccf099ec4460b766b7041a9fb16d489ac795c.tar.gz
emacs-d6bccf099ec4460b766b7041a9fb16d489ac795c.zip
(mail-citation-header): New variable.
(mail-yank-original, mail-yank-region): Bind mail-citation-header. (mail-citation-hook): Doc fix.
-rw-r--r--lisp/mail/sendmail.el38
1 files changed, 32 insertions, 6 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index ad3e3355e67..e79c9ac9b85 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -164,15 +164,22 @@ It is semi-obsolete and mail agents should no longer use it.")
164 164
165(defcustom mail-citation-hook nil 165(defcustom mail-citation-hook nil
166 "*Hook for modifying a citation just inserted in the mail buffer. 166 "*Hook for modifying a citation just inserted in the mail buffer.
167Each hook function can find the citation between (point) and (mark t). 167Each hook function can find the citation between (point) and (mark t),
168And each hook function should leave point and mark around the citation 168and should leave point and mark around the citation text as modified.
169text as modified. 169The hook functions can find the header of the cited message
170in the variable `mail-citation-header', whether or not this is included
171in the cited portion of the message.
170 172
171If this hook is entirely empty (nil), a default action is taken 173If this hook is entirely empty (nil), a default action is taken
172instead of no action." 174instead of no action."
173 :type 'hook 175 :type 'hook
174 :group 'sendmail) 176 :group 'sendmail)
175 177
178(defvar mail-citation-header nil
179 "While running `mail-citation-hook', this variable holds the message header.
180This enables the hook functions to see the whole message header
181regardless of what part of it (if any) is included in the cited text.")
182
176(defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*" 183(defcustom mail-citation-prefix-regexp "[ \t]*[-a-z0-9A-Z]*>+[ \t]*\\|[ \t]*"
177 "*Regular expression to match a citation prefix plus whitespace. 184 "*Regular expression to match a citation prefix plus whitespace.
178It should match whatever sort of citation prefixes you want to handle, 185It should match whatever sort of citation prefixes you want to handle,
@@ -1187,7 +1194,17 @@ and don't delete any header fields."
1187 ;; on account of mark's being inactive. 1194 ;; on account of mark's being inactive.
1188 (mark-even-if-inactive t)) 1195 (mark-even-if-inactive t))
1189 (if mail-citation-hook 1196 (if mail-citation-hook
1190 (run-hooks 'mail-citation-hook) 1197 ;; Bind mail-citation-hook to the inserted message's header.
1198 (let ((mail-citation-header
1199 (buffer-substring-no-properties
1200 start
1201 (save-excursion
1202 (save-restriction
1203 (narrow-to-region start (point-max))
1204 (goto-char start)
1205 (rfc822-goto-eoh)
1206 (point))))))
1207 (run-hooks 'mail-citation-hook))
1191 (if mail-yank-hooks 1208 (if mail-yank-hooks
1192 (run-hooks 'mail-yank-hooks) 1209 (run-hooks 'mail-yank-hooks)
1193 (mail-indent-citation))))) 1210 (mail-indent-citation)))))
@@ -1235,7 +1252,7 @@ and don't delete any header fields."
1235 (mark-even-if-inactive t)) 1252 (mark-even-if-inactive t))
1236 ;; Insert the citation text. 1253 ;; Insert the citation text.
1237 (insert (with-current-buffer buffer 1254 (insert (with-current-buffer buffer
1238 (buffer-substring (point) (mark)))) 1255 (buffer-substring-no-properties (point) (mark))))
1239 (push-mark start) 1256 (push-mark start)
1240 ;; Indent or otherwise annotate the citation text. 1257 ;; Indent or otherwise annotate the citation text.
1241 (if (consp arg) 1258 (if (consp arg)
@@ -1243,7 +1260,16 @@ and don't delete any header fields."
1243 (let ((mail-indentation-spaces (if arg (prefix-numeric-value arg) 1260 (let ((mail-indentation-spaces (if arg (prefix-numeric-value arg)
1244 mail-indentation-spaces))) 1261 mail-indentation-spaces)))
1245 (if mail-citation-hook 1262 (if mail-citation-hook
1246 (run-hooks 'mail-citation-hook) 1263 ;; Bind mail-citation-hook to the original message's header.
1264 (let ((mail-citation-header
1265 (with-current-buffer buffer
1266 (buffer-substring-no-properties
1267 (point-min)
1268 (save-excursion
1269 (goto-char (point-min))
1270 (rfc822-goto-eoh)
1271 (point))))))
1272 (run-hooks 'mail-citation-hook))
1247 (if mail-yank-hooks 1273 (if mail-yank-hooks
1248 (run-hooks 'mail-yank-hooks) 1274 (run-hooks 'mail-yank-hooks)
1249 (mail-indent-citation)))))))) 1275 (mail-indent-citation))))))))