Merge pull request #2292 from manufactory/master

More customizable maildir shortcuts
This commit is contained in:
Dirk-Jan C. Binnema 2022-12-28 10:55:57 +02:00 committed by GitHub
commit 56099998e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 9 deletions

View File

@ -92,11 +92,13 @@ This makes it possible to quickly go to a particular
maildir (folder), or quickly moving messages to them (e.g., for maildir (folder), or quickly moving messages to them (e.g., for
archiving or refiling). archiving or refiling).
Each of the list elements is a plist with at least: Each of the list elements is a plist with at least a
`:maildir' - the maildir for the shortcut (e.g. \"/archive\") `:maildir' - the maildir for the shortcut (e.g. \"/archive\")
`:key' - the shortcut key.
Optionally, you can add the following: Optionally, you can add the following:
`:key' - the shortcut key, can also be a string that gets
displayed in the main view.
`:name' - name of the maildir to be displayed in main-view.
`:hide' - if t, the shortcut is hidden from the main-view and `:hide' - if t, the shortcut is hidden from the main-view and
speedbar. speedbar.
`:hide-unread' - do not show the counts of unread/total number `:hide-unread' - do not show the counts of unread/total number
@ -164,7 +166,8 @@ This is compatibile with `mu4e-bookmarks'."
(seq-map (seq-map
(lambda (item) (lambda (item)
(let* ((maildir (plist-get item :maildir)) (let* ((maildir (plist-get item :maildir))
(item (plist-put item :name maildir)) (name (or (plist-get item :name) maildir))
(item (plist-put item :name name))
(item (plist-put item :query (format "maildir:\"%s\"" maildir)))) (item (plist-put item :query (format "maildir:\"%s\"" maildir))))
item)) ;; we don't need ":maildir", but it's harmless. item)) ;; we don't need ":maildir", but it's harmless.
(mu4e-maildir-shortcuts))) (mu4e-maildir-shortcuts)))

View File

@ -210,7 +210,7 @@ clicked."
with longest = (mu4e--longest-of-maildirs-and-bookmarks) with longest = (mu4e--longest-of-maildirs-and-bookmarks)
with queries = (plist-get mu4e--server-props :queries) with queries = (plist-get mu4e--server-props :queries)
for m in mds for m in mds
for key = (string (plist-get m :key)) for key = (plist-get m :key)
for name = (plist-get m :name) for name = (plist-get m :name)
for query = (plist-get m :query) for query = (plist-get m :query)
for qcounts = (and (stringp query) for qcounts = (and (stringp query)
@ -226,9 +226,12 @@ clicked."
when (not (and mu4e-main-hide-fully-read (eq unread 0))) when (not (and mu4e-main-hide-fully-read (eq unread 0)))
concat (concat concat (concat
;; menu entry ;; menu entry
(mu4e--main-action-str (cond ((characterp key)
(concat "\t* [j" key "] " name) (mu4e--main-action-str
(concat "j" key)) (concat "\t* [j" (string key) "] " name)
(concat "j" (string key))))
((stringp key) (concat "\t* " key " " name))
(t (concat "\t* " name)))
;; append all/unread numbers, if available. ;; append all/unread numbers, if available.
(if qcounts (if qcounts
(let ((unread (plist-get (car qcounts) :unread)) (let ((unread (plist-get (car qcounts) :unread))

View File

@ -2016,7 +2016,9 @@ quick access to, for example:
(:maildir "/archive" :key ?a) (:maildir "/archive" :key ?a)
(:maildir "/lists" :key ?l) (:maildir "/lists" :key ?l)
(:maildir "/work" :key ?w) (:maildir "/work" :key ?w)
(:maildir "/sent" :key ?s))) (:maildir "/sent" :key ?s)
(:maildir "/lists/project_a/list_b" :key "Lab")
(:maildir "/lists/project_c/list_x" :key ?x :name "Project X")))
@end lisp @end lisp
This sets @key{i} as a shortcut for the @t{/inbox} folder --- effectively a This sets @key{i} as a shortcut for the @t{/inbox} folder --- effectively a
@ -2025,7 +2027,9 @@ query @t{maildir:/inbox}. There is a special shortcut @key{o} or @key{/} for
choose from @emph{all} maildirs that you have. There is support for choose from @emph{all} maildirs that you have. There is support for
autocompletion; note that the list of maildirs is determined when @t{mu4e} autocompletion; note that the list of maildirs is determined when @t{mu4e}
starts; if there are changes in the maildirs while @t{mu4e} is running, you starts; if there are changes in the maildirs while @t{mu4e} is running, you
need to restart @t{mu4e}. need to restart @t{mu4e}. Optionally, you can specify a name to be displayed
in the main view. The key can also be a string, in that case the string gets
displayed in the main view. This is useful e.g. for calling custom Hydras.
Each of the folder names is relative to your top-level maildir directory; so Each of the folder names is relative to your top-level maildir directory; so
if you keep your mail in @file{~/Maildir}, @file{/inbox} would refer to if you keep your mail in @file{~/Maildir}, @file{/inbox} would refer to