mu4e: improve startup routine

Switch to main buffer if it already exists, in the non-background case.
This commit is contained in:
Dirk-Jan C. Binnema 2023-11-10 16:33:50 +02:00
parent 171fe9a018
commit 2058f15506
1 changed files with 8 additions and 7 deletions

View File

@ -61,13 +61,14 @@
Then, show the main window, unless BACKGROUND (prefix-argument) Then, show the main window, unless BACKGROUND (prefix-argument)
is non-nil." is non-nil."
(interactive "P") (interactive "P")
(if (and (not background) (buffer-live-p mu4e-main-buffer-name)) (if (not (mu4e-running-p))
;; already running. (progn
(switch-to-buffer mu4e-main-buffer-name) (mu4e--init-handlers)
;; start mu4e, then show the main view (mu4e--start (unless background #'mu4e--main-view)))
(mu4e--init-handlers) ;; mu4e already running
(mu4e--start (when (and (not background)
(unless background #'mu4e--main-view)))) (buffer-live-p (get-buffer mu4e-main-buffer-name)))
(switch-to-buffer mu4e-main-buffer-name))))
(defun mu4e-quit(&optional bury) (defun mu4e-quit(&optional bury)
"Quit the mu4e session or bury the buffer. "Quit the mu4e session or bury the buffer.