Function: rmail-mail-return

rmail-mail-return is a byte-compiled function defined in rmail.el.gz.

Signature

(rmail-mail-return &optional NEWBUF)

Documentation

Try to return to Rmail from the mail window.

If optional argument NEWBUF is specified, it is the Rmail buffer to switch to.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/rmail.el.gz
(defun rmail-mail-return (&optional newbuf)
  "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.
   ((or (null (delq (selected-frame) (visible-frame-list)))
	(not (or (window-dedicated-p (frame-selected-window))
		 (and pop-up-frames (one-window-p))
		 (cdr (assq 'mail-dedicated-frame
			    (frame-parameters))))))
    (let (rmail-flag summary-buffer)
      (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 (buffer-live-p 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)
    (delete-frame))
   ;; The previous frame is where normally they have the Rmail buffer
   ;; displayed.
   (t (other-frame -1))))