mu4e: add prefix arg to mu4e-quit

Remove mu4e-main-quit-or-bury and simply update mu4e-quit
to take a prefix which, if non-nil, make mu4e-quit
bury the buffer rather than quite mu4e.

Also make the mu4e check for an existing mu4e buffer, and if found,
switch to it rather start mu4e.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-07 19:13:11 +03:00
parent 843c086b2c
commit 31bb84182b
4 changed files with 30 additions and 27 deletions

View File

@ -61,18 +61,26 @@
Then, show the main window, unless BACKGROUND (prefix-argument)
is non-nil."
(interactive "P")
;; start mu4e, then show the main view
(mu4e--init-handlers)
(mu4e--start
(unless background #'mu4e--main-view)))
(if (and (not background) (buffer-live-p mu4e-main-buffer-name))
;; already running.
(switch-to-buffer mu4e-main-buffer-name)
;; start mu4e, then show the main view
(mu4e--init-handlers)
(mu4e--start
(unless background #'mu4e--main-view))))
(defun mu4e-quit()
"Quit the mu4e session."
(interactive)
(if mu4e-confirm-quit
(when (y-or-n-p (mu4e-format "Are you sure you want to quit?"))
(mu4e--stop))
(mu4e--stop)))
(defun mu4e-quit(&optional bury)
"Quit the mu4e session or bury the buffer.
If prefix-argument BURY is non-nil, merely bury the buffer.
Otherwise, completely quit mu4e, including automatic updating."
(interactive "P")
(if bury
(bury-buffer)
(if mu4e-confirm-quit
(when (y-or-n-p (mu4e-format "Are you sure you want to quit?"))
(mu4e--stop))
(mu4e--stop))))
;;; Internals