aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-04-26 01:33:18 +0000
committerRichard M. Stallman1997-04-26 01:33:18 +0000
commitfa2795ca04029bde1df7a513262d3b5c064c8b92 (patch)
treeb5e79f2bc49e2f83296b2b6d16db9899a20ea5c0
parent7e68b0eaf376550b883d4d4d8f87836245397a83 (diff)
downloademacs-fa2795ca04029bde1df7a513262d3b5c064c8b92.tar.gz
emacs-fa2795ca04029bde1df7a513262d3b5c064c8b92.zip
(rmail-reply): Pass Rmail buffer and msgnum
as arguments within the mail-send action. (rmail-forward, rmail-retry-failure): Likewise. (rmail-mark-message): New function. (rmail-only-expunge): Update the new kind of action. (rmail-send-actions-rmail-msg-number) (rmail-send-actions-rmail-buffer): Variables no longer used.
-rw-r--r--lisp/mail/rmail.el86
1 files changed, 29 insertions, 57 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 34290cf429c..bed604883de 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -2226,12 +2226,16 @@ Deleted messages stay in the file until the \\[rmail-expunge] command is given."
2226 (while bufs 2226 (while bufs
2227 (save-excursion 2227 (save-excursion
2228 (set-buffer (car bufs)) 2228 (set-buffer (car bufs))
2229 (and (boundp 'rmail-send-actions-rmail-buffer) 2229 (let ((tail mail-send-actions) action)
2230 (eq rmail-send-actions-rmail-buffer rmailbuf) 2230 (while tail
2231 (setq rmail-send-actions-rmail-msg-number 2231 (setq action (car tail)
2232 (rmail-msg-number-after-expunge 2232 tail (cdr tail))
2233 deleted 2233 (and (eq (car action) 'rmail-mark-message)
2234 rmail-send-actions-rmail-msg-number)))) 2234 (eq (nth 1 action) rmailbuf)
2235 (setcar (nthcdr 2 action)
2236 (rmail-msg-number-after-expunge
2237 deleted
2238 (nth 2 action)))))))
2235 (setq bufs (cdr bufs)))) 2239 (setq bufs (cdr bufs))))
2236 2240
2237 (while (<= number total) 2241 (while (<= number total)
@@ -2314,9 +2318,6 @@ original message into it."
2314 (interactive) 2318 (interactive)
2315 (rmail-start-mail t)) 2319 (rmail-start-mail t))
2316 2320
2317(put 'rmail-send-actions-rmail-buffer 'permanent-local t)
2318(put 'rmail-send-actions-rmail-msg-number 'permanent-local t)
2319
2320(defun rmail-reply (just-sender) 2321(defun rmail-reply (just-sender)
2321 "Reply to the current message. 2322 "Reply to the current message.
2322Normally include CC: to all other recipients of original message; 2323Normally include CC: to all other recipients of original message;
@@ -2387,22 +2388,21 @@ use \\[mail-yank-original] to yank the original message into it."
2387 (if (null cc) to (concat to ", " cc)))))) 2388 (if (null cc) to (concat to ", " cc))))))
2388 (if (string= cc-list "") nil cc-list))) 2389 (if (string= cc-list "") nil cc-list)))
2389 rmail-view-buffer 2390 rmail-view-buffer
2390 (list (list '(lambda () 2391 (list (list 'rmail-mark-message
2391 (let ((msgnum rmail-send-actions-rmail-msg-number)) 2392 rmail-view-buffer
2392 (save-excursion 2393 msgnum
2393 (set-buffer rmail-send-actions-rmail-buffer) 2394 "answered"))
2394 (if msgnum
2395 (rmail-set-attribute "answered" t msgnum)))))))
2396 nil 2395 nil
2397 (list (cons "References" (concat (mapconcat 'identity references " ") 2396 (list (cons "References" (concat (mapconcat 'identity references " ")
2398 " " message-id)))) 2397 " " message-id))))))
2399 ;; We keep the rmail buffer and message number in these 2398
2400 ;; buffer-local vars in the sendmail buffer, 2399(defun rmail-mark-message (buffer msgnum attribute)
2401 ;; so that rmail-only-expunge can relocate the message number. 2400 "Give BUFFER's message number MSGNUM the attribute ATTRIBUTE.
2402 (make-local-variable 'rmail-send-actions-rmail-buffer) 2401This is use in the send-actions for message buffers."
2403 (make-local-variable 'rmail-send-actions-rmail-msg-number) 2402 (save-excursion
2404 (setq rmail-send-actions-rmail-buffer rmail-view-buffer) 2403 (set-buffer buffer)
2405 (setq rmail-send-actions-rmail-msg-number msgnum))) 2404 (if msgnum
2405 (rmail-set-attribute attribute t msgnum))))
2406 2406
2407(defun rmail-make-in-reply-to-field (from date message-id) 2407(defun rmail-make-in-reply-to-field (from date message-id)
2408 (cond ((not from) 2408 (cond ((not from)
@@ -2480,15 +2480,9 @@ see the documentation of `rmail-resend'."
2480 "]"))) 2480 "]")))
2481 (if (rmail-start-mail 2481 (if (rmail-start-mail
2482 nil nil subject nil nil nil 2482 nil nil subject nil nil nil
2483 (list (list (function 2483 (list (list 'rmail-mark-message
2484 (lambda () 2484 forward-buffer msgnum
2485 (let ((msgnum 2485 "forwarded"))
2486 rmail-send-actions-rmail-msg-number))
2487 (save-excursion
2488 (set-buffer rmail-send-actions-rmail-buffer)
2489 (if msgnum
2490 (rmail-set-attribute
2491 "forwarded" t msgnum))))))))
2492 ;; If only one window, use it for the mail buffer. 2486 ;; If only one window, use it for the mail buffer.
2493 ;; Otherwise, use another window for the mail buffer 2487 ;; Otherwise, use another window for the mail buffer
2494 ;; so that the Rmail buffer remains visible 2488 ;; so that the Rmail buffer remains visible
@@ -2496,13 +2490,6 @@ see the documentation of `rmail-resend'."
2496 (and (not rmail-mail-new-frame) (one-window-p t))) 2490 (and (not rmail-mail-new-frame) (one-window-p t)))
2497 ;; The mail buffer is now current. 2491 ;; The mail buffer is now current.
2498 (save-excursion 2492 (save-excursion
2499 ;; We keep the rmail buffer and message number in these
2500 ;; buffer-local vars in the sendmail buffer,
2501 ;; so that rmail-only-expunge can relocate the message number.
2502 (make-local-variable 'rmail-send-actions-rmail-buffer)
2503 (make-local-variable 'rmail-send-actions-rmail-msg-number)
2504 (setq rmail-send-actions-rmail-buffer forward-buffer)
2505 (setq rmail-send-actions-rmail-msg-number msgnum)
2506 ;; Insert after header separator--before signature if any. 2493 ;; Insert after header separator--before signature if any.
2507 (goto-char (point-min)) 2494 (goto-char (point-min))
2508 (search-forward-regexp 2495 (search-forward-regexp
@@ -2710,29 +2697,14 @@ specifying headers which should not be copied into the new message."
2710 ;; Start sending a new message; default header fields from the original. 2697 ;; Start sending a new message; default header fields from the original.
2711 ;; Turn off the usual actions for initializing the message body 2698 ;; Turn off the usual actions for initializing the message body
2712 ;; because we want to get only the text from the failure message. 2699 ;; because we want to get only the text from the failure message.
2713 (let ((action 2700 (let (mail-signature mail-setup-hook)
2714 ;; This function will be called when the user sends the retry.
2715 ;; It will mark the bounce message as "retried".
2716 (function (lambda ()
2717 (let ((msgnum rmail-send-actions-rmail-msg-number))
2718 (save-excursion
2719 (set-buffer rmail-send-actions-rmail-buffer)
2720 (if msgnum
2721 (rmail-set-attribute "retried" t msgnum)))))))
2722 mail-signature mail-setup-hook)
2723 (if (rmail-start-mail nil nil nil nil nil rmail-buffer 2701 (if (rmail-start-mail nil nil nil nil nil rmail-buffer
2724 (list (list action))) 2702 (list (list 'rmail-mark-message
2703 rmail-buffer msgnum "retried")))
2725 ;; Insert original text as initial text of new draft message. 2704 ;; Insert original text as initial text of new draft message.
2726 ;; Bind inhibit-read-only since the header delimiter 2705 ;; Bind inhibit-read-only since the header delimiter
2727 ;; of the previous message was probably read-only. 2706 ;; of the previous message was probably read-only.
2728 (let ((inhibit-read-only t)) 2707 (let ((inhibit-read-only t))
2729 ;; We keep the rmail buffer and message number in these
2730 ;; buffer-local vars in the sendmail buffer,
2731 ;; so that the rmail-only-expunge can relocate the message number.
2732 (make-local-variable 'rmail-send-actions-rmail-buffer)
2733 (make-local-variable 'rmail-send-actions-rmail-msg-number)
2734 (setq rmail-send-actions-rmail-buffer rmail-buffer)
2735 (setq rmail-send-actions-rmail-msg-number msgnum)
2736 (erase-buffer) 2708 (erase-buffer)
2737 (insert-buffer-substring rmail-buffer bounce-start bounce-end) 2709 (insert-buffer-substring rmail-buffer bounce-start bounce-end)
2738 (goto-char (point-min)) 2710 (goto-char (point-min))