mu4e: get maildirs from server

We were determining the list of maildirs using, but his is rather *slow*.
So instead, get it from the server, through a "data" call.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-13 09:46:45 +03:00
parent a16d288c70
commit c554e5194a
4 changed files with 23 additions and 44 deletions

View File

@ -88,6 +88,10 @@ to take effect, you need to stop/start mu4e."
:group 'mu4e
:safe 'booleanp)
;; Cached data
(defvar mu4e-maildir-list)
;; Handlers are not strictly internal, but are not meant
;; for overriding outside mu4e. The are mainly for breaking
@ -398,6 +402,12 @@ The server output is as follows:
((plist-get sexp :info)
(funcall mu4e-info-func sexp))
;; get some data
((plist-get sexp :data)
(pcase (plist-get sexp :data)
('maildirs (setq mu4e-maildir-list (plist-get sexp :value)))
(_ (mu4e-warn "unknown data kind"))))
;; receive an error
((plist-get sexp :error)
(funcall mu4e-error-func
@ -577,6 +587,12 @@ get at most MAX contacts."
:tstamp ,(or tstamp nil)
:maxnum ,(or maxnum nil))))
(defun mu4e--server-data (kind)
"Request data of some KIND.
KIND is a symbol. Currently supported kinds: maildirs."
(mu4e--server-call-mu
`(data :kind ,kind)))
(defun mu4e--server-find (query threads sortfield sortdir maxnum skip-dups
include-related)
"Run QUERY with THREADS SORTFIELD SORTDIR MAXNUM SKIP-DUPS INCLUDE-RELATED.