[notmuch] [PATCH] notmuch.el: Add face support to search and show mode
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Fri, 20 Nov 2009 15:27:24 +0000 (20:57 +0530)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:37 +0000 (09:35 -0800)
87/4dff298275688dba8eb3bf16cba24ab7658aa7 [new file with mode: 0644]

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