# HG changeset patch # User Richard M. Stallman # Date 862018398 0 # Node ID 09d1f6578d7f1575ac05c956398cbe7256f3f241 # Parent 050f15e0b9482b0a76697d6fcf51bdf8c94616b6 (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. diff -r 050f15e0b948 -r 09d1f6578d7f lisp/mail/rmail.el --- a/lisp/mail/rmail.el Fri Apr 25 21:59:44 1997 +0000 +++ b/lisp/mail/rmail.el Sat Apr 26 01:33:18 1997 +0000 @@ -2226,12 +2226,16 @@ (while bufs (save-excursion (set-buffer (car bufs)) - (and (boundp 'rmail-send-actions-rmail-buffer) - (eq rmail-send-actions-rmail-buffer rmailbuf) - (setq rmail-send-actions-rmail-msg-number - (rmail-msg-number-after-expunge - deleted - rmail-send-actions-rmail-msg-number)))) + (let ((tail mail-send-actions) action) + (while tail + (setq action (car tail) + tail (cdr tail)) + (and (eq (car action) 'rmail-mark-message) + (eq (nth 1 action) rmailbuf) + (setcar (nthcdr 2 action) + (rmail-msg-number-after-expunge + deleted + (nth 2 action))))))) (setq bufs (cdr bufs)))) (while (<= number total) @@ -2314,9 +2318,6 @@ (interactive) (rmail-start-mail t)) -(put 'rmail-send-actions-rmail-buffer 'permanent-local t) -(put 'rmail-send-actions-rmail-msg-number 'permanent-local t) - (defun rmail-reply (just-sender) "Reply to the current message. Normally include CC: to all other recipients of original message; @@ -2387,22 +2388,21 @@ (if (null cc) to (concat to ", " cc)))))) (if (string= cc-list "") nil cc-list))) rmail-view-buffer - (list (list '(lambda () - (let ((msgnum rmail-send-actions-rmail-msg-number)) - (save-excursion - (set-buffer rmail-send-actions-rmail-buffer) - (if msgnum - (rmail-set-attribute "answered" t msgnum))))))) + (list (list 'rmail-mark-message + rmail-view-buffer + msgnum + "answered")) nil (list (cons "References" (concat (mapconcat 'identity references " ") - " " message-id)))) - ;; We keep the rmail buffer and message number in these - ;; buffer-local vars in the sendmail buffer, - ;; so that rmail-only-expunge can relocate the message number. - (make-local-variable 'rmail-send-actions-rmail-buffer) - (make-local-variable 'rmail-send-actions-rmail-msg-number) - (setq rmail-send-actions-rmail-buffer rmail-view-buffer) - (setq rmail-send-actions-rmail-msg-number msgnum))) + " " message-id)))))) + +(defun rmail-mark-message (buffer msgnum attribute) + "Give BUFFER's message number MSGNUM the attribute ATTRIBUTE. +This is use in the send-actions for message buffers." + (save-excursion + (set-buffer buffer) + (if msgnum + (rmail-set-attribute attribute t msgnum)))) (defun rmail-make-in-reply-to-field (from date message-id) (cond ((not from) @@ -2480,15 +2480,9 @@ "]"))) (if (rmail-start-mail nil nil subject nil nil nil - (list (list (function - (lambda () - (let ((msgnum - rmail-send-actions-rmail-msg-number)) - (save-excursion - (set-buffer rmail-send-actions-rmail-buffer) - (if msgnum - (rmail-set-attribute - "forwarded" t msgnum)))))))) + (list (list 'rmail-mark-message + forward-buffer msgnum + "forwarded")) ;; If only one window, use it for the mail buffer. ;; Otherwise, use another window for the mail buffer ;; so that the Rmail buffer remains visible @@ -2496,13 +2490,6 @@ (and (not rmail-mail-new-frame) (one-window-p t))) ;; The mail buffer is now current. (save-excursion - ;; We keep the rmail buffer and message number in these - ;; buffer-local vars in the sendmail buffer, - ;; so that rmail-only-expunge can relocate the message number. - (make-local-variable 'rmail-send-actions-rmail-buffer) - (make-local-variable 'rmail-send-actions-rmail-msg-number) - (setq rmail-send-actions-rmail-buffer forward-buffer) - (setq rmail-send-actions-rmail-msg-number msgnum) ;; Insert after header separator--before signature if any. (goto-char (point-min)) (search-forward-regexp @@ -2710,29 +2697,14 @@ ;; Start sending a new message; default header fields from the original. ;; Turn off the usual actions for initializing the message body ;; because we want to get only the text from the failure message. - (let ((action - ;; This function will be called when the user sends the retry. - ;; It will mark the bounce message as "retried". - (function (lambda () - (let ((msgnum rmail-send-actions-rmail-msg-number)) - (save-excursion - (set-buffer rmail-send-actions-rmail-buffer) - (if msgnum - (rmail-set-attribute "retried" t msgnum))))))) - mail-signature mail-setup-hook) + (let (mail-signature mail-setup-hook) (if (rmail-start-mail nil nil nil nil nil rmail-buffer - (list (list action))) + (list (list 'rmail-mark-message + rmail-buffer msgnum "retried"))) ;; Insert original text as initial text of new draft message. ;; Bind inhibit-read-only since the header delimiter ;; of the previous message was probably read-only. (let ((inhibit-read-only t)) - ;; We keep the rmail buffer and message number in these - ;; buffer-local vars in the sendmail buffer, - ;; so that the rmail-only-expunge can relocate the message number. - (make-local-variable 'rmail-send-actions-rmail-buffer) - (make-local-variable 'rmail-send-actions-rmail-msg-number) - (setq rmail-send-actions-rmail-buffer rmail-buffer) - (setq rmail-send-actions-rmail-msg-number msgnum) (erase-buffer) (insert-buffer-substring rmail-buffer bounce-start bounce-end) (goto-char (point-min))