mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 20:38:08 +01:00
notmuch.el: Add face support to search mode
This patch use notmuch-tag-face showing tags in the notmuch-search-mode. We can selectively highlight each tag by setting notmuch-tag-face-alist as below (defface notmuch-tag-unread-face '((((class color)) (:foreground "goldenrod"))) "Notmuch search mode face used to highligh tags.") (defface notmuch-tag-inbox-face '((((class color)) (:foreground "red"))) "Notmuch search mode face used to highligh tags.") (setq notmuch-tag-face-alist '(("unread" . 'notmuch-tag-unread-face) ("inbox" . 'notmuch-tag-inbox-face))) (require 'notmuch) Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
This commit is contained in:
parent
ea124966e7
commit
92c4dcc641
1 changed files with 29 additions and 1 deletions
30
notmuch.el
30
notmuch.el
|
@ -949,6 +949,23 @@ thread from that buffer can be show when done with this one)."
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(forward-line -1))
|
(forward-line -1))
|
||||||
|
|
||||||
|
(defface notmuch-tag-face
|
||||||
|
'((((class color)
|
||||||
|
(background dark))
|
||||||
|
(:foreground "OliveDrab1"))
|
||||||
|
(((class color)
|
||||||
|
(background light))
|
||||||
|
(:foreground "navy blue" :bold t))
|
||||||
|
(t
|
||||||
|
(:bold t)))
|
||||||
|
"Notmuch search mode face used to highligh tags."
|
||||||
|
:group 'notmuch)
|
||||||
|
|
||||||
|
(defvar notmuch-tag-face-alist nil
|
||||||
|
"List containing the tag list that need to be highlighed")
|
||||||
|
|
||||||
|
(defvar notmuch-search-font-lock-keywords nil)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun notmuch-search-mode ()
|
(defun notmuch-search-mode ()
|
||||||
"Major mode for searching mail with notmuch.
|
"Major mode for searching mail with notmuch.
|
||||||
|
@ -979,7 +996,18 @@ global search.
|
||||||
(setq truncate-lines t)
|
(setq truncate-lines t)
|
||||||
(setq major-mode 'notmuch-search-mode
|
(setq major-mode 'notmuch-search-mode
|
||||||
mode-name "notmuch-search")
|
mode-name "notmuch-search")
|
||||||
(setq buffer-read-only t))
|
(setq buffer-read-only t)
|
||||||
|
(if (not notmuch-tag-face-alist)
|
||||||
|
(add-to-list 'notmuch-search-font-lock-keywords (list
|
||||||
|
"(\\([^)]*\\))$" '(1 'notmuch-tag-face)))
|
||||||
|
(progn
|
||||||
|
(setq notmuch-search-tags (mapcar 'car notmuch-tag-face-alist))
|
||||||
|
(loop for notmuch-search-tag in notmuch-search-tags
|
||||||
|
do (add-to-list 'notmuch-search-font-lock-keywords (list
|
||||||
|
(concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")
|
||||||
|
`(1 ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))
|
||||||
|
(set (make-local-variable 'font-lock-defaults)
|
||||||
|
'(notmuch-search-font-lock-keywords t)))
|
||||||
|
|
||||||
(defun notmuch-search-find-thread-id ()
|
(defun notmuch-search-find-thread-id ()
|
||||||
"Return the thread for the current thread"
|
"Return the thread for the current thread"
|
||||||
|
|
Loading…
Reference in a new issue