Merge pull request #714 from avar/avar/mu4e-mark-support-mu4e-use-fancy-chars

mu4e: Add support for mu4e-use-fancy-chars to the marking in the headers view
This commit is contained in:
Dirk-Jan C. Binnema 2015-12-13 18:20:30 +02:00
commit d8ecc98349
1 changed files with 19 additions and 6 deletions

View File

@ -124,7 +124,13 @@ is either a headers or view buffer."
"The list of all the possible marks. "The list of all the possible marks.
This is an alist mapping mark symbols to their properties. The This is an alist mapping mark symbols to their properties. The
properties are: properties are:
:char (string) The character to display in the headers view :char (string) or (basic . fancy) The character to display in
the headers view. Either a single-character string, or a
dotted-pair cons cell where the second item will be used if
`mu4e-use-fancy-chars' is `t' or `marks', otherwise we'll use
the first one. It can also be a plain string for backwards
compatibility since we didn't always support
`mu4e-use-fancy-chars' here.
:prompt (string) The prompt to use when asking for marks (used for :prompt (string) The prompt to use when asking for marks (used for
example when marking a whole thread) example when marking a whole thread)
:ask-target (function returning a string) Get the target. This :ask-target (function returning a string) Get the target. This
@ -147,7 +153,7 @@ properties are:
:dyn-target (lambda (target msg) (mu4e-get-refile-folder msg)) :dyn-target (lambda (target msg) (mu4e-get-refile-folder msg))
:action (lambda (docid msg target) (mu4e~proc-move docid (mu4e~mark-check-target target) "-N"))) :action (lambda (docid msg target) (mu4e~proc-move docid (mu4e~mark-check-target target) "-N")))
(delete (delete
:char "D" :char ("D" . "🗙")
:prompt "Delete" :prompt "Delete"
:show-target (lambda (target) "delete") :show-target (lambda (target) "delete")
:action (lambda (docid msg target) (mu4e~proc-remove docid))) :action (lambda (docid msg target) (mu4e~proc-remove docid)))
@ -167,7 +173,7 @@ properties are:
:show-target (lambda (target) "read") :show-target (lambda (target) "read")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "+S-u-N"))) :action (lambda (docid msg target) (mu4e~proc-move docid nil "+S-u-N")))
(trash (trash
:char "d" :char ("d" . "🗑")
:prompt "dtrash" :prompt "dtrash"
:dyn-target (lambda (target msg) (mu4e-get-trash-folder msg)) :dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
:action (lambda (docid msg target) (mu4e~proc-move docid (mu4e~mark-check-target target) "+T-N"))) :action (lambda (docid msg target) (mu4e~proc-move docid (mu4e~mark-check-target target) "+T-N")))
@ -235,9 +241,16 @@ The following marks are available, and the corresponding props:
;; target (the target folder) the other ones get a pseudo "target", as ;; target (the target folder) the other ones get a pseudo "target", as
;; info for the user. ;; info for the user.
(markdesc (cdr (or (assq mark mu4e-marks) (mu4e-error "Invalid mark %S" mark)))) (markdesc (cdr (or (assq mark mu4e-marks) (mu4e-error "Invalid mark %S" mark))))
(markkar (plist-get markdesc :char)) (get-markkar
(target (mu4e~mark-get-dyn-target mark target)) (lambda (char)
(show-fct (plist-get markdesc :show-target)) (if (listp char)
(if (or (eq mu4e-use-fancy-chars t)
(eq mu4e-use-fancy-chars 'marks))
(cdr char) (car char))
char)))
(markkar (funcall get-markkar (plist-get markdesc :char)))
(target (mu4e~mark-get-dyn-target mark target))
(show-fct (plist-get markdesc :show-target))
(shown-target (if show-fct (shown-target (if show-fct
(funcall show-fct target) (funcall show-fct target)
(if target (format "%S" target))))) (if target (format "%S" target)))))