summaryrefslogtreecommitdiff
path: root/mu4e/mu4e.el
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-01-25 15:23:34 +0200
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-01-26 18:56:38 +0200
commit7f76c69879f1f07a34e25946d56e340bb2a477d7 (patch)
tree0eb502ac8d70ca0e6a5a763d6f3d94b4452f2b27 /mu4e/mu4e.el
parenta33530e9179743bea41d06b248cdb9be4f2e5e9f (diff)
mu4e: auto start mu4e when sending command
Start mu4e if not already; with the transient menus it's easier possible to try to do things with mu4e before it is started, so handle that automatically.
Diffstat (limited to 'mu4e/mu4e.el')
-rw-r--r--mu4e/mu4e.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/mu4e/mu4e.el b/mu4e/mu4e.el
index 0594759..a89ea4d 100644
--- a/mu4e/mu4e.el
+++ b/mu4e/mu4e.el
@@ -56,13 +56,16 @@
(with-eval-after-load 'desktop
(eval '(add-to-list 'desktop-modes-not-to-save 'mu4e-compose-mode)))
+(defvar mu4e--initialized nil
+ "Is mu4e initialized? Only needed once per session.")
+
;;;###autoload
(defun mu4e (&optional background)
"If mu4e is not running yet, start it.
Then, show the main window, unless BACKGROUND (prefix-argument)
is non-nil."
(interactive "P")
- (if (not (mu4e-running-p))
+ (if (not mu4e--initialized)
(progn
(mu4e--init-handlers)
(mu4e--start (unless background #'mu4e--main-view)))
@@ -148,12 +151,13 @@ Otherwise, check requirements, then start mu4e. When successful, invoke
(mu4e-modeline-mode (if mu4e-modeline-support 1 -1))
;; redraw main buffer if there is one.
(add-hook 'mu4e-query-items-updated-hook #'mu4e--main-redraw)
- (mu4e--query-items-refresh 'reset-baseline)
+ (setq mu4e--initialized t) ;; last before we call the server.
(mu4e--server-ping)
;; ask for the maildir-list
(mu4e--server-data 'maildirs)
;; maybe request the list of contacts, automatically refreshed after
;; re-indexing
+ (mu4e--query-items-refresh 'reset-baseline)
(unless mu4e--contacts-set
(mu4e--request-contacts-maybe)))