summaryrefslogtreecommitdiff
path: root/lisp/mail/rmail.el
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-04-20 12:17:59 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-04-20 12:17:59 -0700
commit4b932ea214c5293ce71abf51e6b09c74eea532ce (patch)
treee49f590473166e1cbad7222a797e50d7acc52f67 /lisp/mail/rmail.el
parent24c51a09d6150ca56383a091fc945210ff3fe673 (diff)
downloademacs-4b932ea214c5293ce71abf51e6b09c74eea532ce.tar.gz
Fix logic for returning to and yanking from Rmail buffer.
* mail/rmail.el (rmail-start-mail): Pass (rmail-mail-return...) for the return-action. Pass (rmail-yank-current-message...) for the yank-action. (rmail-yank-current-message): New function. (rmail-mail): Pass the Rmail buffer, not view buffer, for replybuffer. (rmail-reply): Likewise. (rmail-forward): Pass the Rmail buffer, not nil, for replybuffer. * mail/sendmail.el (mail-bury): Choose the first rmail-mode buffer, not the last. Reject temp buffers. Use the rmail-mode buffer, not newbuf.
Diffstat (limited to 'lisp/mail/rmail.el')
-rw-r--r--lisp/mail/rmail.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 3a9ba8122ab..265347ca69a 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -3560,6 +3560,16 @@ does not pop any summary buffer."
;;;; *** Rmail Mailing Commands ***
+(defun rmail-yank-current-message (buffer)
+ "Yank into the current buffer the current message of Rmail buffer BUFFER.
+If BUFFER is swapped with its message viewer buffer, yank out of BUFFER.
+If BUFFER is not swapped, yank out of its message viewer buffer."
+ (with-current-buffer buffer
+ (unless (rmail-buffers-swapped-p)
+ (setq buffer rmail-view-buffer)))
+ (insert-buffer buffer))
+
+
(defun rmail-start-mail (&optional noerase to subject in-reply-to cc
replybuffer sendactions same-window
other-headers)
@@ -3571,7 +3581,8 @@ does not pop any summary buffer."
(if replybuffer
;; The function used here must behave like insert-buffer wrt
;; point and mark (see doc of sc-cite-original).
- (setq yank-action (list 'insert-buffer replybuffer)))
+ (setq yank-action
+ `(rmail-yank-current-message ,replybuffer)))
(push (cons "cc" cc) other-headers)
(push (cons "in-reply-to" in-reply-to) other-headers)
(setq other-headers
@@ -3587,7 +3598,7 @@ does not pop any summary buffer."
(prog1
(compose-mail to subject other-headers noerase
switch-function yank-action sendactions
- `(rmail-mail-return ,replybuffer))
+ (if replybuffer `(rmail-mail-return ,replybuffer)))
(if (eq switch-function 'switch-to-buffer-other-frame)
;; This is not a standard frame parameter; nothing except
;; sendmail.el looks at it.
@@ -3644,7 +3655,7 @@ to switch to."
While composing the message, use \\[mail-yank-original] to yank the
original message into it."
(interactive)
- (rmail-start-mail nil nil nil nil nil rmail-view-buffer))
+ (rmail-start-mail nil nil nil nil nil rmail-buffer))
;; FIXME should complain if there is nothing to continue.
(defun rmail-continue ()
@@ -3731,9 +3742,7 @@ use \\[mail-yank-original] to yank the original message into it."
(mail-strip-quoted-names
(if (null cc) to (concat to ", " cc))))))
(if (string= cc-list "") nil cc-list)))
- (if (rmail-buffers-swapped-p)
- rmail-buffer
- rmail-view-buffer)
+ rmail-buffer
(list (list 'rmail-mark-message
rmail-buffer
(with-current-buffer rmail-buffer
@@ -3835,7 +3844,7 @@ see the documentation of `rmail-resend'."
(or (mail-fetch-field "Subject") "")
"]")))
(if (rmail-start-mail
- nil nil subject nil nil nil
+ nil nil subject nil nil rmail-buffer
(list (list 'rmail-mark-message
forward-buffer
(with-current-buffer rmail-buffer