aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-12-07 22:16:27 +0000
committerRichard M. Stallman1996-12-07 22:16:27 +0000
commitc8553837cd0a1b0a87e4e46363d81bb99459f0ff (patch)
tree63c75d6c4eeedf6aae6739544bd6526fd1b5e96f
parentbde7cb3faec9862664f16f642d67cb7cc40e4bcb (diff)
downloademacs-c8553837cd0a1b0a87e4e46363d81bb99459f0ff.tar.gz
emacs-c8553837cd0a1b0a87e4e46363d81bb99459f0ff.zip
(mail-reply-action): Renamed from mail-reply-buffer.
(mail-yank-original): Handle either an action or a buffer in mail-reply-action. (mail): Doc fix. (mail-mode-fill-paragraph): New function. (mail-mode): Set fill-paragraph-function.
-rw-r--r--lisp/mail/sendmail.el73
1 files changed, 60 insertions, 13 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index faed238e239..27273995bd6 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -161,10 +161,10 @@ If t, it means to insert the contents of the file `mail-signature-file'.")
161(defvar mail-signature-file "~/.signature" 161(defvar mail-signature-file "~/.signature"
162 "*File containing the text inserted at end of mail buffer.") 162 "*File containing the text inserted at end of mail buffer.")
163 163
164(defvar mail-reply-buffer nil) 164(defvar mail-reply-action nil)
165(defvar mail-send-actions nil 165(defvar mail-send-actions nil
166 "A list of actions to be performed upon successful sending of a message.") 166 "A list of actions to be performed upon successful sending of a message.")
167(put 'mail-reply-buffer 'permanent-local t) 167(put 'mail-reply-action 'permanent-local t)
168(put 'mail-send-actions 'permanent-local t) 168(put 'mail-send-actions 'permanent-local t)
169 169
170(defvar mail-default-headers nil 170(defvar mail-default-headers nil
@@ -252,7 +252,7 @@ actually occur.")
252 (if (file-exists-p mail-personal-alias-file) 252 (if (file-exists-p mail-personal-alias-file)
253 (build-mail-aliases)))) 253 (build-mail-aliases))))
254 (setq mail-send-actions actions) 254 (setq mail-send-actions actions)
255 (setq mail-reply-buffer replybuffer) 255 (setq mail-reply-action replybuffer)
256 (goto-char (point-min)) 256 (goto-char (point-min))
257 (insert "To: ") 257 (insert "To: ")
258 (save-excursion 258 (save-excursion
@@ -322,7 +322,7 @@ C-c C-q mail-fill-yanked-message (fill what was yanked).
322C-c C-v mail-sent-via (add a Sent-via field for each To or CC)." 322C-c C-v mail-sent-via (add a Sent-via field for each To or CC)."
323 (interactive) 323 (interactive)
324 (kill-all-local-variables) 324 (kill-all-local-variables)
325 (make-local-variable 'mail-reply-buffer) 325 (make-local-variable 'mail-reply-action)
326 (make-local-variable 'mail-send-actions) 326 (make-local-variable 'mail-send-actions)
327 (set-syntax-table mail-mode-syntax-table) 327 (set-syntax-table mail-mode-syntax-table)
328 (use-local-map mail-mode-map) 328 (use-local-map mail-mode-map)
@@ -336,6 +336,7 @@ C-c C-v mail-sent-via (add a Sent-via field for each To or CC)."
336 (make-local-variable 'paragraph-start) 336 (make-local-variable 'paragraph-start)
337 (make-local-variable 'normal-auto-fill-function) 337 (make-local-variable 'normal-auto-fill-function)
338 (setq normal-auto-fill-function 'mail-mode-auto-fill) 338 (setq normal-auto-fill-function 'mail-mode-auto-fill)
339 (setq fill-paragraph-function 'mail-mode-fill-paragraph)
339 ;; `-- ' precedes the signature. `-----' appears at the start of the 340 ;; `-- ' precedes the signature. `-----' appears at the start of the
340 ;; lines that delimit forwarded messages. 341 ;; lines that delimit forwarded messages.
341 ;; Lines containing just >= 3 dashes, perhaps after whitespace, 342 ;; Lines containing just >= 3 dashes, perhaps after whitespace,
@@ -366,6 +367,45 @@ If within the headers, this makes the new lines into continuation lines."
366 (forward-line -1)) 367 (forward-line -1))
367 t))) 368 t)))
368 (do-auto-fill))) 369 (do-auto-fill)))
370
371(defun mail-mode-fill-paragraph (arg)
372 ;; Do something special only if within the headers.
373 (if (< (point)
374 (save-excursion
375 (goto-char (point-min))
376 (if (search-forward mail-header-separator nil t)
377 (point)
378 0)))
379 (let (beg end fieldname)
380 (re-search-backward "^[-a-zA-Z]+:" nil 'yes)
381 (setq beg (point))
382 (setq fieldname
383 (downcase (buffer-substring beg (1- (match-end 0)))))
384 (forward-line 1)
385 ;; Find continuation lines and get rid of their continuation markers.
386 (while (looking-at "[ \t]")
387 (delete-horizontal-space)
388 (forward-line 1))
389 (setq end (point-marker))
390 (goto-char beg)
391 ;; If this field contains addresses,
392 ;; make sure we can fill after each address.
393 (if (member fieldname
394 '("to" "cc" "bcc" "from" "reply-to"
395 "resent-to" "resent-cc" "resent-bcc"
396 "resent-from" "resent-reply-to"))
397 (while (search-forward "," end t)
398 (or (looking-at "[ \t]")
399 (insert " "))))
400 (fill-region-as-paragraph beg end)
401 ;; Mark all lines except the first as continuations.
402 (goto-char beg)
403 (forward-line 1)
404 (while (< (point) end)
405 (insert " ")
406 (forward-line 1))
407 (move-marker end nil)
408 t)))
369 409
370;;; Set up keymap. 410;;; Set up keymap.
371 411
@@ -930,13 +970,18 @@ However, if `mail-yank-prefix' is non-nil, insert that prefix on each line.
930Just \\[universal-argument] as argument means don't indent, insert no prefix, 970Just \\[universal-argument] as argument means don't indent, insert no prefix,
931and don't delete any header fields." 971and don't delete any header fields."
932 (interactive "P") 972 (interactive "P")
933 (if mail-reply-buffer 973 (if mail-reply-action
934 (let ((start (point))) 974 (let ((start (point))
935 ;; If the original message is in another window in the same frame, 975 (original mail-reply-action))
936 ;; delete that window to save screen space. 976 (and (consp original) (eq (car original) 'insert-buffer)
937 ;; t means don't alter other frames. 977 (setq original (nth 1 original)))
938 (delete-windows-on mail-reply-buffer t) 978 (if (consp original)
939 (insert-buffer mail-reply-buffer) 979 (apply (car original) (cdr original))
980 ;; If the original message is in another window in the same frame,
981 ;; delete that window to save screen space.
982 ;; t means don't alter other frames.
983 (delete-windows-on original t)
984 (insert-buffer original))
940 (if (consp arg) 985 (if (consp arg)
941 nil 986 nil
942 (goto-char start) 987 (goto-char start)
@@ -1007,8 +1052,10 @@ The second through fifth arguments,
1007 TO, SUBJECT, IN-REPLY-TO and CC, specify if non-nil 1052 TO, SUBJECT, IN-REPLY-TO and CC, specify if non-nil
1008 the initial contents of those header fields. 1053 the initial contents of those header fields.
1009 These arguments should not have final newlines. 1054 These arguments should not have final newlines.
1010The sixth argument REPLYBUFFER is a buffer whose contents 1055The sixth argument REPLYBUFFER is a buffer which contains an
1011 should be yanked if the user types C-c C-y. 1056 original message being replied to, or else an action
1057 of the form (FUNCTION . ARGS) which says how to insert the original.
1058 Or it can be nil, if not replying to anything.
1012The seventh argument ACTIONS is a list of actions to take 1059The seventh argument ACTIONS is a list of actions to take
1013 if/when the message is sent. Each action looks like (FUNCTION . ARGS); 1060 if/when the message is sent. Each action looks like (FUNCTION . ARGS);
1014 when the message is sent, we apply FUNCTION to ARGS. 1061 when the message is sent, we apply FUNCTION to ARGS.