mu4e: more support for fancy-chars

Re-simplify `mu4e-use-fancy-chars` to a boolean again; add some extra
mark-chars (big character, so they are easily visible). Document it.
This commit is contained in:
djcb 2015-12-15 09:07:17 +02:00
parent 3cf96899ef
commit ddcd2f39b5
4 changed files with 91 additions and 94 deletions

View File

@ -170,28 +170,26 @@ Field must be a symbol, one of: :date, :subject, :size, :prio,
"Direction to sort by; a symbol either `descending' (sorting
Z->A) or `ascending' (sorting A->Z).")
;; marks for headers of the form; each is a cons-cell (basic . fancy)
;; each of which is basic ascii char and something fancy, respectively
(defvar mu4e-headers-draft-mark '("D" . "") "Draft.")
(defvar mu4e-headers-flagged-mark '("F" . "") "Flagged.")
(defvar mu4e-headers-new-mark '("N" . "") "New.")
(defvar mu4e-headers-flagged-mark '("F" . "") "Flagged.")
(defvar mu4e-headers-new-mark '("N" . "") "New.")
(defvar mu4e-headers-passed-mark '("P" . "") "Passed (fwd).")
(defvar mu4e-headers-replied-mark '("R" . "") "Replied.")
(defvar mu4e-headers-seen-mark '("S" . "") "Seen.")
(defvar mu4e-headers-trashed-mark '("T" . "") "Trashed.")
(defvar mu4e-headers-trashed-mark '("T" . "") "Trashed.")
(defvar mu4e-headers-attach-mark '("a" . "") "W/ attachments.")
(defvar mu4e-headers-encrypted-mark '("x" . "") "Encrypted.")
(defvar mu4e-headers-signed-mark '("s" . "") "Signed.")
(defvar mu4e-headers-unread-mark '("u" . "") "Unread.")
(defvar mu4e-headers-unread-mark '("u" . "🖂") "Unread.")
;; thread prefix marks
(defvar mu4e-headers-has-child-prefix '("+" . "") "Parent.")
(defvar mu4e-headers-empty-parent-prefix '("-" . "") "Orphan.")
(defvar mu4e-headers-first-child-prefix '("\\" . "┗▶") "First child.")
(defvar mu4e-headers-duplicate-prefix '("=" . "") "Duplicate.")
(defvar mu4e-headers-default-prefix '("|" . "") "Default.")
(defvar mu4e-headers-duplicate-prefix '("=" . "") "Duplicate.")
(defvar mu4e-headers-default-prefix '("|" . "") "Default.")
(defvar mu4e-headers-actions
'( ("capture message" . mu4e-action-capture-message)
@ -354,8 +352,7 @@ into a string."
"Calculate the thread prefix based on thread info THREAD."
(when thread
(let ((get-prefix
(lambda (cell) (if (or (eq mu4e-use-fancy-chars t)
(eq mu4e-use-fancy-chars 'threads)) (cdr cell) (car cell)))))
(lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell)))))
(concat
(make-string (* (if (plist-get thread :empty-parent) 0 1)
(plist-get thread :level)) ?\s)
@ -380,9 +377,7 @@ internally, the Maildir spec determines what the flags look like,
while our display may be different)."
(let ((str "")
(get-prefix
(lambda (cell) (if (or (eq mu4e-use-fancy-chars t)
(eq mu4e-use-fancy-chars 'marks)) (cdr cell) (car cell)))))
(lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell)))))
(dolist (flag mu4e-headers-visible-flags)
(when (member flag flags)
(setq str

View File

@ -120,14 +120,79 @@ is either a headers or view buffer."
,@body)
(progn (mu4e-message "%S" major-mode) ,@body))))))
(defvar mu4e-marks nil
(defvar mu4e-marks
'((refile
:char ("r" . "")
:prompt "refile"
: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")))
(delete
:char ("D" . "🗙")
:prompt "Delete"
:show-target (lambda (target) "delete")
:action (lambda (docid msg target) (mu4e~proc-remove docid)))
(flag
:char ("+" . "")
:prompt "+flag"
:show-target (lambda (target) "flag")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "+F-u-N")))
(move
:char ("m" . "")
:prompt "move"
:ask-target mu4e~mark-get-move-target
:action (lambda (docid msg target) (mu4e~proc-move docid
(mu4e~mark-check-target target) "-N")))
(read
:char ("!" . "")
:prompt "!read"
:show-target (lambda (target) "read")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "+S-u-N")))
(trash
:char ("d" . "")
:prompt "dtrash"
: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")))
(unflag
:char ("-" . "")
:prompt "-unflag"
:show-target (lambda (target) "unflag")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-F-N")))
(untrash
:char ("=" . "🡸")
:prompt "=untrash"
:show-target (lambda (target) "untrash")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-T")))
(unread
:char ("?" . "")
:prompt "?unread"
:show-target (lambda (target) "unread")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-S+u-N")))
(unmark
:char " "
:prompt "unmark"
:action (mu4e-error "No action for unmarking"))
(action
:char ( "a" . "🗲")
:prompt "action"
:ask-target (lambda () (mu4e-read-option "Action: " mu4e-headers-actions))
:action (lambda (docid msg actionfunc)
(save-excursion
(when (mu4e~headers-goto-docid docid)
(mu4e-headers-action actionfunc)))))
(something
:char ("*" . "")
:prompt "*something"
:action (mu4e-error "No action for deferred mark")))
"The list of all the possible marks.
This is an alist mapping mark symbols to their properties. The
properties are:
: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
`mu4e-use-fancy-chars' is `t', 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.
@ -142,73 +207,7 @@ properties are:
:show-target (function from TARGET to string) How to display
the target.
:action (function taking (DOCID MSG TARGET)). The action to
apply on the message.
")
(unless mu4e-marks
(setq mu4e-marks
'((refile
:char "r"
:prompt "refile"
: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")))
(delete
:char ("D" . "🗙")
:prompt "Delete"
:show-target (lambda (target) "delete")
:action (lambda (docid msg target) (mu4e~proc-remove docid)))
(flag
:char "+"
:prompt "+flag"
:show-target (lambda (target) "flag")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "+F-u-N")))
(move
:char "m"
:prompt "move"
:ask-target mu4e~mark-get-move-target
:action (lambda (docid msg target) (mu4e~proc-move docid (mu4e~mark-check-target target) "-N")))
(read
:char "!"
:prompt "!read"
:show-target (lambda (target) "read")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "+S-u-N")))
(trash
:char ("d" . "🗑")
:prompt "dtrash"
: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")))
(unflag
:char "-"
:prompt "-unflag"
:show-target (lambda (target) "unflag")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-F-N")))
(untrash
:char "="
:prompt "=untrash"
:show-target (lambda (target) "untrash")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-T")))
(unread
:char "?"
:prompt "?unread"
:show-target (lambda (target) "unread")
:action (lambda (docid msg target) (mu4e~proc-move docid nil "-S+u-N")))
(unmark
:char " "
:prompt "unmark"
:action (mu4e-error "No action for unmarking"))
(action
:char "a"
:prompt "action"
:ask-target (lambda () (mu4e-read-option "Action: " mu4e-headers-actions))
:action (lambda (docid msg actionfunc)
(save-excursion
(when (mu4e~headers-goto-docid docid)
(mu4e-headers-action actionfunc)))))
(something
:char "*"
:prompt "*something"
:action (mu4e-error "No action for deferred mark"))
)))
apply on the message.")
(defun mu4e-mark-at-point (mark target)
@ -244,9 +243,7 @@ The following marks are available, and the corresponding props:
(get-markkar
(lambda (char)
(if (listp char)
(if (or (eq mu4e-use-fancy-chars t)
(eq mu4e-use-fancy-chars 'marks))
(cdr char) (car char))
(if mu4e-use-fancy-chars (cdr char) (car char))
char)))
(markkar (funcall get-markkar (plist-get markdesc :char)))
(target (mu4e~mark-get-dyn-target mark target))

View File

@ -141,11 +141,11 @@ as per RFC531."
'mu4e-user-mail-address-list "0.9.9.x")
(defcustom mu4e-use-fancy-chars nil
"Whether to use fancy (non-ascii) characters for marks and/or threads."
:type '(choice (const :tag "Do not use fancy chars" nil)
(const :tag "Use fancy chars everywhere" t)
(const :tag "Use fancy chars only for threads" threads)
(const :tag "Use fancy chars only for marks" marks))
"Whether to use fancy (Unicode) characters for marks and
threads. You can customize the exact fancy characters used with
`mu4e-marks' and various `mu4e-headers-..-mark' and
`mu4e-headers..-prefix' variables."
:type 'boolean
:group 'mu4e)
(defcustom mu4e-date-format-long "%c"

View File

@ -3445,8 +3445,10 @@ should take you to the right place in this manual.
See @ref{Setting the default emacs mail program}.
@item @emph{Can @t{mu4e} use some fancy Unicode characters instead of these
boring plain-ASCII ones?} Glad you asked! Yes, if you set
@code{mu4e-use-fancy-chars} to @t{t}, @t{mu4e} uses such fancy characters in a
number of places.
@code{mu4e-use-fancy-chars} to @t{t}, @t{mu4e} uses such fancy
characters in a number of places. Since not all fonts include all
characters, you may want to install the @t{unifont} and/or @t{symbola}
fonts on your system.
@item @emph{Can I start @t{mu4e} in the background?} Yes - if you provide a
prefix-argument (@key{C-u}), @t{mu4e} starts, but does not show the
main-window.
@ -3935,8 +3937,8 @@ slightly off; the reason for this issue is that Inconsolata does not
contain the glyphs for the 'fancy' arrows and the glyphs that are used
as replacements are too high.
To fix this, you can use something like the following workaround (in your
@t{.emacs}-file):
To fix this, you can use something like the following workaround (in
your @t{.emacs}-file):
@lisp
(if (equal window-system 'x)
(progn
@ -3944,6 +3946,9 @@ To fix this, you can use something like the following workaround (in your
(set-face-font 'default "Inconsolata-10")))
@end lisp
Other fonts with good support for Unicode are @t{unifont} and
@t{symbola}.
@node Confirmation before sending
@section Confirmation before sending