better handle maildir cache

- get an updated maildir list after indexing
- add mu4e-added items to the list opportunistically

Remove mu4e-clear-caches / mu4e-cache-maildir-list to mu4e-obsolete.el

Fixes #2537.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-19 19:41:56 +03:00
parent 15f08488d3
commit f73aad2b41
6 changed files with 40 additions and 35 deletions

View File

@ -643,7 +643,13 @@ the directory time stamp."
(defun mu4e--server-mkdir (path &optional update)
"Create a new maildir-directory at filesystem PATH.
When UPDATE is non-nil, send a update when completed."
When UPDATE is non-nil, send a update when completed.
PATH must be below the root-maildir."
;; handle maildir cache
(if (not (string-prefix-p (mu4e-root-maildir) path))
(mu4e-error "Cannot create maildir outside root-maildir")
(add-to-list 'mu4e-maildir-list ;; update cache
(substring path (length (mu4e-root-maildir)))))
(mu4e--server-call-mu `(mkdir
:path ,path
:update ,(or update nil))))