mu4e-folder: don't offer "other" if there are none
When mu4e is not started yet, we don't have "other" maildirs; document and don't add the 'other' option. Fixes #2855.
This commit is contained in:
@ -262,12 +262,14 @@ just the query-string.
|
|||||||
|
|
||||||
If the special shortcut \"o\" (for _o_ther) is used, or if there
|
If the special shortcut \"o\" (for _o_ther) is used, or if there
|
||||||
a no single-key elements in (mu4e-maildir-shortcuts), let user
|
a no single-key elements in (mu4e-maildir-shortcuts), let user
|
||||||
choose from all maildirs under `mu4e-maildir'.
|
choose from all maildirs under `mu4e-maildir'. This is only
|
||||||
|
available if mu4e is already running.
|
||||||
|
|
||||||
The names of the maildirs are displayed in the minibuffer,
|
The names of the maildirs are displayed in the minibuffer,
|
||||||
suffixed with the short version of the unread counts, as per
|
suffixed with the short version of the unread counts, as per
|
||||||
`mu4e--query-item-display-short-counts'."
|
`mu4e--query-item-display-short-counts'."
|
||||||
(let* ((mdirs
|
(let* ((other-dirs (mu4e-get-maildirs))
|
||||||
|
(mdirs
|
||||||
(seq-map
|
(seq-map
|
||||||
(lambda (md)
|
(lambda (md)
|
||||||
(let* ((qitem (mu4e--query-item-for-maildir-shortcut md))
|
(let* ((qitem (mu4e--query-item-for-maildir-shortcut md))
|
||||||
@ -280,14 +282,16 @@ suffixed with the short version of the unread counts, as per
|
|||||||
unreads) md)))
|
unreads) md)))
|
||||||
(mu4e-filter-single-key (mu4e-maildir-shortcuts))))
|
(mu4e-filter-single-key (mu4e-maildir-shortcuts))))
|
||||||
;; special case: handle pseudo-maildir 'other
|
;; special case: handle pseudo-maildir 'other
|
||||||
(mdirs (and mdirs (append mdirs '(("oOther..." . other)))))
|
(mdirs (if (and mdirs other-dirs)
|
||||||
|
(append mdirs '(("oOther..." . other)))
|
||||||
|
mdirs))
|
||||||
(chosen (and mdirs (mu4e-read-option prompt mdirs)))
|
(chosen (and mdirs (mu4e-read-option prompt mdirs)))
|
||||||
;; if chosen nothing or other, ask for more.
|
;; if chosen nothing or other, ask for more.
|
||||||
(chosen (if (or (not chosen) (eq chosen 'other))
|
(chosen (if (or (not chosen) (eq chosen 'other))
|
||||||
(list :maildir
|
(list :maildir
|
||||||
(substring-no-properties
|
(substring-no-properties
|
||||||
(funcall mu4e-completing-read-function prompt
|
(funcall mu4e-completing-read-function prompt
|
||||||
(mu4e-get-maildirs) nil nil
|
other-dirs nil nil
|
||||||
mu4e-maildir-initial-input)))
|
mu4e-maildir-initial-input)))
|
||||||
chosen)))
|
chosen)))
|
||||||
;; return either the maildir (as a string), or the corresponding
|
;; return either the maildir (as a string), or the corresponding
|
||||||
|
|||||||
Reference in New Issue
Block a user