Mercurial > emacs
comparison lisp/mail/rmail.el @ 17565:09d1f6578d7f
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 26 Apr 1997 01:33:18 +0000 |
parents | 09aeacdc6fc2 |
children | 30a88c9b3505 |
comparison
equal
deleted
inserted
replaced
17564:050f15e0b948 | 17565:09d1f6578d7f |
---|---|
2224 ;; message number. | 2224 ;; message number. |
2225 (let ((bufs (buffer-list))) | 2225 (let ((bufs (buffer-list))) |
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) |
2238 (if (= (aref deleted number) ?D) | 2242 (if (= (aref deleted number) ?D) |
2239 (progn | 2243 (progn |
2311 | 2315 |
2312 (defun rmail-continue () | 2316 (defun rmail-continue () |
2313 "Continue composing outgoing message previously being composed." | 2317 "Continue composing outgoing message previously being composed." |
2314 (interactive) | 2318 (interactive) |
2315 (rmail-start-mail t)) | 2319 (rmail-start-mail t)) |
2316 | |
2317 (put 'rmail-send-actions-rmail-buffer 'permanent-local t) | |
2318 (put 'rmail-send-actions-rmail-msg-number 'permanent-local t) | |
2319 | 2320 |
2320 (defun rmail-reply (just-sender) | 2321 (defun rmail-reply (just-sender) |
2321 "Reply to the current message. | 2322 "Reply to the current message. |
2322 Normally include CC: to all other recipients of original message; | 2323 Normally include CC: to all other recipients of original message; |
2323 prefix argument means ignore them. While composing the reply, | 2324 prefix argument means ignore them. While composing the reply, |
2385 (let* ((cc-list (rmail-dont-reply-to | 2386 (let* ((cc-list (rmail-dont-reply-to |
2386 (mail-strip-quoted-names | 2387 (mail-strip-quoted-names |
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) | 2401 This 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) |
2409 (if message-id | 2409 (if message-id |
2410 message-id | 2410 message-id |
2478 "")) | 2478 "")) |
2479 (or (mail-fetch-field "Subject") "") | 2479 (or (mail-fetch-field "Subject") "") |
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 |
2495 ;; and sending the mail will get back to it. | 2489 ;; and sending the mail will get back to it. |
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 |
2509 (concat "^" (regexp-quote mail-header-separator) "$")) | 2496 (concat "^" (regexp-quote mail-header-separator) "$")) |
2510 (forward-line 1) | 2497 (forward-line 1) |
2708 (error "Cannot find end of header in failed message")) | 2695 (error "Cannot find end of header in failed message")) |
2709 )))) | 2696 )))) |
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)) |
2739 (if bounce-indent | 2711 (if bounce-indent |
2740 (indent-rigidly (point-min) (point-max) bounce-indent)) | 2712 (indent-rigidly (point-min) (point-max) bounce-indent)) |