Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 66668431FBC for ; Fri, 20 Nov 2009 07:27:33 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zFpS4pQ7VFdB for ; Fri, 20 Nov 2009 07:27:32 -0800 (PST) Received: from e28smtp02.in.ibm.com (e28smtp02.in.ibm.com [122.248.162.2]) by olra.theworths.org (Postfix) with ESMTP id 21FCE431FAE for ; Fri, 20 Nov 2009 07:27:31 -0800 (PST) Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp02.in.ibm.com (8.14.3/8.13.1) with ESMTP id nAKFRSSG031145 for ; Fri, 20 Nov 2009 20:57:28 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAKFRRLo2629714 for ; Fri, 20 Nov 2009 20:57:28 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAKFRR4a013074 for ; Fri, 20 Nov 2009 20:57:27 +0530 Received: from localhost.localdomain ([9.124.222.167]) by d28av01.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nAKFRQKF013066; Fri, 20 Nov 2009 20:57:26 +0530 From: "Aneesh Kumar K.V" To: notmuch@notmuchmail.org Date: Fri, 20 Nov 2009 20:57:24 +0530 Message-Id: <1258730844-8711-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.6.5.2.74.g610f9 Subject: [notmuch] [PATCH] notmuch.el: Add face support to search and show mode X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Nov 2009 15:27:33 -0000 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 the unread tag in the notmuch-search-mode. The changes are done looking at message.el in emacs source Signed-off-by: Aneesh Kumar K.V --- notmuch.el | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 50 insertions(+), 5 deletions(-) diff --git a/notmuch.el b/notmuch.el index 4b2936a..71e9dea 100644 --- a/notmuch.el +++ b/notmuch.el @@ -603,9 +603,37 @@ which this thread was originally shown." (force-window-update) (redisplay t)) +(defun notmuch-font-lock-matcher (regexp) + (let ((form + `(lambda (limit) + (let ((start (point))) + (save-restriction + (widen) + (goto-char (point-min)) + (setq limit (min limit (point-max))) + (goto-char start)) + (and (< start limit) + (re-search-forward ,regexp limit t)))))) + (if (featurep 'bytecomp) + (byte-compile form) + form))) + +(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 + (let ((content "")) + `((,(notmuch-font-lock-matcher + (concat "\\(Subject:.*$\\)" content)) + (1 'notmuch-show-subject-face nil t)))) + "Additonal expression to hightlight in notmuch-search-mode") + ;;;###autoload -(defun notmuch-show-mode () - "Major mode for viewing a thread with notmuch. +(define-derived-mode notmuch-show-mode text-mode "notmuch-show" +"Major mode for viewing a thread with notmuch. This buffer contains the results of the \"notmuch show\" command for displaying a single thread of email from your email archives. @@ -643,7 +671,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 @@ -769,8 +799,21 @@ thread from that buffer can be show when done with this one)." (end-of-buffer arg) (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 inbox tags." + :group 'notmuch) + +(defvar notmuch-search-font-lock-keywords + (let ((content "")) + `((,(notmuch-font-lock-matcher + (concat "\\(unread\\)" content)) + (1 'notmuch-tag-unread-face nil t)))) + "Additonal expression to hightlight in notmuch-search-mode") + ;;;###autoload -(defun notmuch-search-mode () +(define-derived-mode notmuch-search-mode text-mode "notmuch-search" "Major mode for searching mail with notmuch. This buffer contains the results of a \"notmuch search\" of your @@ -799,7 +842,9 @@ 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) + (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