mu4e-folders: rework the mu4e-ask-maildir
Attempt to restore the old behaviour of _other_ when there are no maildir shortcuts defined. Should help for #2843.
This commit is contained in:
@ -248,22 +248,20 @@ to create it; otherwise return nil."
|
||||
"Get maildirs under `mu4e-maildir'."
|
||||
mu4e-maildir-list)
|
||||
|
||||
|
||||
(defun mu4e-ask-maildir (prompt &optional query-item)
|
||||
"Ask the user for a maildir (using PROMPT).
|
||||
|
||||
If QUERY-ITEM is non-nil, return the full query-item rather than
|
||||
just the query-string.
|
||||
|
||||
If the special shortcut \"o\" (for _o_ther) is used, or
|
||||
if (mu4e-maildir-shortcuts) evaluates to nil, let user choose
|
||||
from all maildirs under `mu4e-maildir'.
|
||||
If the special shortcut \"o\" (for _o_ther) is used, or if there
|
||||
a no single-key elements in (mu4e-maildir-shortcuts), let user
|
||||
choose from all maildirs under `mu4e-maildir'.
|
||||
|
||||
The names of the maildirs are displayed in the minibuffer,
|
||||
suffixed with the short version of the unread counts, as per
|
||||
`mu4e--query-item-display-short-counts'."
|
||||
(let* ((mdirs
|
||||
(append
|
||||
(seq-map
|
||||
(lambda (md)
|
||||
(let* ((qitem (mu4e--query-item-for-maildir-shortcut md))
|
||||
@ -274,11 +272,12 @@ suffixed with the short version of the unread counts, as per
|
||||
(or (plist-get md :name)
|
||||
(plist-get md :maildir))
|
||||
unreads) md)))
|
||||
(mu4e-filter-single-key (mu4e-maildir-shortcuts)))
|
||||
'(("oOther..." . other)))) ;; append "Other" pseudo-maildir
|
||||
(chosen (mu4e-read-option prompt mdirs))
|
||||
(mu4e-filter-single-key (mu4e-maildir-shortcuts))))
|
||||
;; special case: handle pseudo-maildir 'other
|
||||
(chosen (if (eq chosen 'other)
|
||||
(mdirs (and mdirs (append mdirs '(("oOther..." . other)))))
|
||||
(chosen (and mdirs (mu4e-read-option prompt mdirs)))
|
||||
;; if chosen nothing or other, ask for more.
|
||||
(chosen (if (or (not chosen) (eq chosen 'other))
|
||||
(list :maildir
|
||||
(substring-no-properties
|
||||
(funcall mu4e-completing-read-function prompt
|
||||
@ -287,9 +286,7 @@ suffixed with the short version of the unread counts, as per
|
||||
chosen)))
|
||||
;; return either the maildir (as a string), or the corresponding
|
||||
;; query-item.
|
||||
(if query-item
|
||||
chosen
|
||||
(plist-get chosen :maildir))))
|
||||
(if query-item chosen (plist-get chosen :maildir))))
|
||||
|
||||
(defun mu4e-ask-maildir-check-exists (prompt)
|
||||
"Like `mu4e-ask-maildir', PROMPT for existence of the maildir.
|
||||
|
||||
Reference in New Issue
Block a user