* mu4e: mu4e-headers: use purecopy, and mimic tabulated-list-mode a bit more closely

This commit is contained in:
djcb 2012-09-16 21:46:47 +03:00
parent b4219bd06b
commit 6956e6e26c
1 changed files with 33 additions and 30 deletions

View File

@ -80,24 +80,24 @@ vertical split-view."
;; 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" . "") "Mark for draft messages.")
(defvar mu4e-headers-flagged-mark '("F" . "") "Mark for flagged messages.")
(defvar mu4e-headers-new-mark '("N" . "") "Mark for new messages.")
(defvar mu4e-headers-passed-mark '("P" . "") "Mark for passed (fwd) messages.")
(defvar mu4e-headers-replied-mark '("R" . "") "Mark for replied messages.")
(defvar mu4e-headers-seen-mark '("S" . "") "Mark for seen messages.")
(defvar mu4e-headers-trashed-mark '("T" . "") "Mark for trashed messages.")
(defvar mu4e-headers-attach-mark '("a" . "a") "Mark for messages w/ attachments.")
(defvar mu4e-headers-encrypted-mark '("x" . "") "Mark for encrypted messages.")
(defvar mu4e-headers-signed-mark '("s" . "s") "Mark for signed messages.")
(defvar mu4e-headers-unread-mark '("u" . "u") "Mark for unread messages.")
(defvar mu4e-headers-draft-mark (purecopy '("D" . "")) "Mark for draft messages.")
(defvar mu4e-headers-flagged-mark (purecopy '("F" . "")) "Mark for flagged messages.")
(defvar mu4e-headers-new-mark (purecopy '("N" . "")) "Mark for new messages.")
(defvar mu4e-headers-passed-mark (purecopy '("P" . "")) "Mark for passed (fwd) messages.")
(defvar mu4e-headers-replied-mark (purecopy '("R" . "")) "Mark for replied messages.")
(defvar mu4e-headers-seen-mark (purecopy '("S" . "")) "Mark for seen messages.")
(defvar mu4e-headers-trashed-mark (purecopy '("T" . "")) "Mark for trashed messages.")
(defvar mu4e-headers-attach-mark (purecopy '("a" . "")) "Mark for messages w/ attachments.")
(defvar mu4e-headers-encrypted-mark (purecopy '("x" . "")) "Mark for encrypted messages.")
(defvar mu4e-headers-signed-mark (purecopy '("s" . "")) "Mark for signed messages.")
(defvar mu4e-headers-unread-mark (purecopy '("u" . "")) "Mark for unread messages.")
;; thread prefix marks
(defvar mu4e-headers-has-child-prefix '("+" . "") "Prefix for thread with child(ren).")
(defvar mu4e-headers-empty-parent-prefix '("-" . " ") "Prefix for thread without parent.")
(defvar mu4e-headers-first-child-prefix '("\\" . "┗▶") "Prefix for the first child.")
(defvar mu4e-headers-duplicate-prefix '("=" . "") "Prefix for a duplicate message.")
(defvar mu4e-headers-default-prefix '("|" . "") "Default prefix.")
(defvar mu4e-headers-has-child-prefix (purecopy '("+" . "")) "Thread with child(ren).")
(defvar mu4e-headers-empty-parent-prefix (purecopy '("-" . "")) "Thread without parent.")
(defvar mu4e-headers-first-child-prefix (purecopy '("\\" . "┗▶")) "The first child.")
(defvar mu4e-headers-duplicate-prefix (purecopy '("=" . "")) "Duplicate message.")
(defvar mu4e-headers-default-prefix (purecopy '("|" . "")) "Default prefix.")
(defvar mu4e-headers-actions
@ -151,10 +151,10 @@ PREDICATE-FUNC as PARAM. This is useful for getting user-input.")
;;;; internal variables/constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; docid cookies
(defconst mu4e~headers-docid-pre "\376"
(defconst mu4e~headers-docid-pre (purecopy "\376")
"Each header starts (invisibly) with the `mu4e~headers-docid-pre',
followed by the docid, followed by `mu4e~headers-docid-post'.")
(defconst mu4e~headers-docid-post "\377"
(defconst mu4e~headers-docid-post (purecopy "\377")
"Each header starts (invisibly) with the `mu4e~headers-docid-pre',
followed by the docid, followed by `mu4e~headers-docid-post'.")
@ -366,6 +366,9 @@ if provided, or at the end of the buffer otherwise."
;; now, append the header line
(mu4e~headers-add-header line docid point msg)))
(defconst mu4e~no-matches (purecopy "No matching messages found"))
(defconst mu4e~end-of-results (purecopy "End of search results"))
(defun mu4e~headers-found-handler (count)
"Create a one line description of the number of headers found
after the end of the search results."
@ -375,8 +378,8 @@ after the end of the search results."
(goto-char (point-max))
(let ((inhibit-read-only t)
(str (if (= 0 count)
"No matching messages found"
"End of search results")))
mu4e~no-matches
mu4e~end-of-results)))
(insert (propertize str 'face 'mu4e-system-face 'intangible t))
(unless (= 0 count)
(mu4e-message "Found %d matching message%s"
@ -575,7 +578,7 @@ after the end of the search results."
(arrow
(when (and sortable (eq (car item) mu4e-headers-sortfield))
(if mu4e-headers-sort-revert downarrow uparrow)))
(name (concat arrow (plist-get info :shortname)))
(name (concat (plist-get info :shortname) arrow))
(map (make-sparse-keymap)))
(when sortable
(define-key map [header-line mouse-1]
@ -594,7 +597,7 @@ after the end of the search results."
(if width
(truncate-string-to-width name width 0 ?\s t)
name)
'face 'mu4e-header-title-face
'face (if arrow 'bold 'fixed-pitch)
'help-echo help
'mouse-face (when sortable 'highlight)
'keymap (when sortable map)