]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mail/rmail.el (rmail-start-mail): Add send-action again.
authorChong Yidong <cyd@gnu.org>
Sat, 28 Jan 2012 01:58:27 +0000 (09:58 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 28 Jan 2012 01:58:27 +0000 (09:58 +0800)
(rmail-mail-return): Switch to NEWBUF only if it is non-nil.

Fixes: debbugs:10625
lisp/ChangeLog
lisp/mail/rmail.el

index d8378ef983890038c881edc9ca8aaf92c2ca364f..fb7bdffd426cad5becc8cdce42df0243100710b0 100644 (file)
@@ -1,5 +1,8 @@
 2012-01-28  Chong Yidong  <cyd@gnu.org>
 
+       * mail/rmail.el (rmail-start-mail): Add send-action again (Bug#10625).
+       (rmail-mail-return): Switch to NEWBUF only if it is non-nil.
+
        * cus-edit.el (custom-buffer-create-internal): Fix search button
        action (Bug#10542).
 
index 2a8140dd9727caa27a2a4a6703c33152f292881a..813912f2e9b18a9a9e1ab79b0a9630af594dff44 100644 (file)
@@ -3584,15 +3584,18 @@ does not pop any summary buffer."
     (if (stringp subject) (setq subject (rfc2047-decode-string subject)))
     (prog1
        (compose-mail to subject other-headers noerase
-                     switch-function yank-action sendactions)
+                     switch-function yank-action sendactions
+                     `(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.
-           (modify-frame-parameters (selected-frame)
+         (modify-frame-parameters (selected-frame)
                                   '((mail-dedicated-frame . t)))))))
 
 (defun rmail-mail-return (&optional newbuf)
-  "NEWBUF is a buffer to switch to."
+  "Try to return to Rmail from the mail window.
+If optional argument NEWBUF is specified, it is the Rmail buffer
+to switch to."
   (cond
    ;; If there is only one visible frame with no special handling,
    ;; consider deleting the mail window to return to Rmail.
@@ -3602,23 +3605,30 @@ does not pop any summary buffer."
                 (cdr (assq 'mail-dedicated-frame
                            (frame-parameters))))))
     (let (rmail-flag summary-buffer)
-      (and (not (one-window-p))
-          (with-current-buffer
-              (window-buffer (next-window (selected-window) 'not))
-            (setq rmail-flag (eq major-mode 'rmail-mode))
-            (setq summary-buffer
-                  (and (boundp 'mail-bury-selects-summary)
-                       mail-bury-selects-summary
-                       (boundp 'rmail-summary-buffer)
-                       rmail-summary-buffer
-                       (buffer-name rmail-summary-buffer)
-                       (not (get-buffer-window rmail-summary-buffer))
-                       rmail-summary-buffer))))
-      (if rmail-flag
-         ;; If the Rmail buffer has a summary, show that.
-         (if summary-buffer (switch-to-buffer summary-buffer)
-           (delete-window))
-       (switch-to-buffer newbuf))))
+      (unless (one-window-p)
+       (with-current-buffer
+           (window-buffer (next-window (selected-window) 'not))
+         (setq rmail-flag (eq major-mode 'rmail-mode))
+         (setq summary-buffer
+               (and (boundp 'mail-bury-selects-summary)
+                    mail-bury-selects-summary
+                    (boundp 'rmail-summary-buffer)
+                    rmail-summary-buffer
+                    (buffer-name rmail-summary-buffer)
+                    (not (get-buffer-window rmail-summary-buffer))
+                    rmail-summary-buffer))))
+      (cond ((null rmail-flag)
+            ;; If the Rmail buffer is not in the next window, switch
+            ;; directly to the Rmail buffer specified by NEWBUF.
+            (if newbuf
+                (switch-to-buffer newbuf)))
+           ;; If the Rmail buffer is in the next window, switch to
+           ;; the summary buffer if `mail-bury-selects-summary' is
+           ;; non-nil.  Otherwise just delete this window.
+           (summary-buffer
+            (switch-to-buffer summary-buffer))
+           (t
+            (delete-window)))))
    ;; If the frame was probably made for this buffer, the user
    ;; probably wants to delete it now.
    ((display-multi-frame-p)