From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: notmuch@notmuchmail.org
Subject: [PATCH -v2] notmuch.el: Add face support to search and show mode
Date: Sun, 22 Nov 2009 14:07:56 +0530 [thread overview]
Message-ID: <1258879076-31883-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> (raw)
This add two faces, notmuch-show-subject-face and
notmuch-tag-unread-face. The first face is used to show the subject
line in the notmuch-show-mode and the second one to show the unread
tag in the notmuch-search-mode. We can set additional tags by setting
notmuch-tag-face-alist as below
(defface notmuch-tag-unread-face
'((((class color) (background light)) (:foreground "goldenrod" :bold t))
(((class color) (background dark)) (:foreground "goldenrod" :bold t)))
"Notmuch search mode face used to highligh tags.")
(defface notmuch-tag-inbox-face
'((((class color) (background light)) (:foreground "red" :bold t))
(((class color) (background dark)) (:foreground "red" :bold t)))
"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>
---
notmuch.el | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/notmuch.el b/notmuch.el
index 0144b61..a0f5aaa 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -637,6 +637,18 @@ which this thread was originally shown."
(force-window-update)
(redisplay t))
+(defface notmuch-show-subject-face
+ '((((class color) (background light)) (:foreground "yellow" :bold t))
+ (((class color) (background dark)) (:foreground "yellow" :bold t)))
+ "Notmuch show mode face used to highligh subject line."
+ :group 'notmuch)
+
+(defvar notmuch-show-font-lock-keywords
+ (list ;; header in font-lock-type-face
+ (list "\\(Subject:.*$\\)"
+ '(1 'notmuch-show-subject-face)))
+ "Additonal expression to hightlight in notmuch-show-mode")
+
;;;###autoload
(defun notmuch-show-mode ()
"Major mode for viewing a thread with notmuch.
@@ -677,7 +689,9 @@ view, (remove the \"inbox\" tag from each), with
(use-local-map notmuch-show-mode-map)
(setq major-mode 'notmuch-show-mode
mode-name "notmuch-show")
- (setq buffer-read-only t))
+ (setq buffer-read-only t)
+ (set (make-local-variable 'font-lock-defaults)
+ '(notmuch-show-font-lock-keywords t)))
;;;###autoload
@@ -806,6 +820,17 @@ thread from that buffer can be show when done with this one)."
(goto-char (point-max))
(forward-line -1))
+(defface notmuch-tag-unread-face
+ '((((class color) (background light)) (:foreground "goldenrod" :bold t))
+ (((class color) (background dark)) (:foreground "goldenrod" :bold t)))
+ "Notmuch search mode face used to highligh tags."
+ :group 'notmuch)
+
+(defvar notmuch-tag-face-alist `(("unread" . 'notmuch-tag-unread-face))
+ "List containing the tag list that need to be highlighed")
+
+(defvar notmuch-search-font-lock-keywords nil)
+
;;;###autoload
(defun notmuch-search-mode ()
"Major mode for searching mail with notmuch.
@@ -836,7 +861,14 @@ global search.
(setq truncate-lines t)
(setq major-mode 'notmuch-search-mode
mode-name "notmuch-search")
- (setq buffer-read-only t))
+ (setq buffer-read-only t)
+ (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 ()
(save-excursion
--
1.6.5.2.74.g610f9
next reply other threads:[~2009-11-22 8:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 8:37 Aneesh Kumar K.V [this message]
2009-11-22 12:02 ` [PATCH -v2] notmuch.el: Add face support to search and show mode Carl Worth
2009-11-22 12:21 ` Aneesh Kumar K.V
2009-11-22 22:48 ` Carl Worth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258879076-31883-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).