--- /dev/null
+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 4E01F4916AE\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Mar 2010 08:33:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -5.254\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-5.254 tagged_above=-999 required=5 tests=[AWL=1.345,\r
+ BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4] autolearn=unavailable\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 J6tbIfhfgp3r for <notmuch@notmuchmail.org>;\r
+ Wed, 10 Mar 2010 08:33:44 -0800 (PST)\r
+Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144])\r
+ by olra.theworths.org (Postfix) with ESMTP id BAD7C4916B2\r
+ for <notmuch@notmuchmail.org>; Wed, 10 Mar 2010 08:33:43 -0800 (PST)\r
+Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
+ by e23smtp02.au.ibm.com (8.14.3/8.13.1) with ESMTP id o2AGUB9X022301\r
+ for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 03:30:11 +1100\r
+Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138])\r
+ by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
+ o2AGRgbm1630268\r
+ for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 03:27:42 +1100\r
+Received: from d23av02.au.ibm.com (loopback [127.0.0.1])\r
+ by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
+ o2AGXOd5002277\r
+ for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 03:33:24 +1100\r
+Received: from localhost.localdomain ([9.124.221.30])\r
+ by d23av02.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
+ o2AGXMIS002252; Thu, 11 Mar 2010 03:33:23 +1100\r
+From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>\r
+To: cworth@cworth.org\r
+Date: Wed, 10 Mar 2010 22:03:15 +0530\r
+Message-Id:\r
+ <1268238795-14737-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+X-Mailer: git-send-email 1.7.0.2.157.gb7e7f\r
+In-Reply-To:\r
+ <1264241389-6326-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+References: <1264241389-6326-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
+Cc: "Aneesh Kumar K.V" <aneesh.kumar@gmail.com>, notmuch@notmuchmail.org\r
+Subject: [notmuch] [PATCH -V3] notmuch.el: Support for customizing search\r
+ result display\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Wed, 10 Mar 2010 16:33:44 -0000\r
+\r
+From: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\r
+\r
+This patch helps in customizing search result display\r
+similar to mutt's index_format. The customization is done\r
+by defining an alist as below\r
+\r
+(setq notmuch-search-result-format '(("date" . "%s ")\r
+ ("authors" . "%-40s ")\r
+ ("subject" . "%s ")))\r
+\r
+The supported keywords are date, count, authors, subject.\r
+\r
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\r
+---\r
+ emacs/notmuch.el | 55 +++++++++++++++++++++++++++++++++++++----------------\r
+ 1 files changed, 38 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 5b553bb..cc5167f 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -157,6 +157,18 @@ remaining lines into a button.")\r
+ (defvar notmuch-show-body-read-visible nil)\r
+ (defvar notmuch-show-citations-visible nil)\r
+ (defvar notmuch-show-signatures-visible nil)\r
++(defcustom notmuch-search-result-format\r
++ '(("date" . "%s")\r
++ ("count" . "%-7s")\r
++ ("authors" . "%-40s")\r
++ ("subject" . "%s"))\r
++ "Search result formating. Supported fields are\r
++ date, count, authors, subject\r
++ex: (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)\r
++ \(\"subject\" . \"%s\"\)\)\)"\r
++:type '(alist :key-type (string) :value-type (string))\r
++:group 'notmuch)\r
++\r
+ (defvar notmuch-show-headers-visible nil)\r
+ \r
+ ; XXX: This should be a generic function in emacs somewhere, not here\r
+@@ -1314,11 +1326,6 @@ matching this search term are shown if non-nil. "\r
+ "Notmuch search mode face used to highligh tags."\r
+ :group 'notmuch)\r
+ \r
+-(defvar notmuch-tag-face-alist nil\r
+- "List containing the tag list that need to be highlighed")\r
+-\r
+-(defvar notmuch-search-font-lock-keywords nil)\r
+-\r
+ ;;;###autoload\r
+ (defun notmuch-search-mode ()\r
+ "Major mode displaying results of a notmuch search.\r
+@@ -1356,17 +1363,7 @@ Complete list of currently available key bindings:\r
+ (setq truncate-lines t)\r
+ (setq major-mode 'notmuch-search-mode\r
+ mode-name "notmuch-search")\r
+- (setq buffer-read-only t)\r
+- (if (not notmuch-tag-face-alist)\r
+- (add-to-list 'notmuch-search-font-lock-keywords (list\r
+- "(\\([^)]*\\))$" '(1 'notmuch-tag-face)))\r
+- (let ((notmuch-search-tags (mapcar 'car notmuch-tag-face-alist)))\r
+- (loop for notmuch-search-tag in notmuch-search-tags\r
+- do (add-to-list 'notmuch-search-font-lock-keywords (list\r
+- (concat "([^)]*\\(" notmuch-search-tag "\\)[^)]*)$")\r
+- `(1 ,(cdr (assoc notmuch-search-tag notmuch-tag-face-alist))))))))\r
+- (set (make-local-variable 'font-lock-defaults)\r
+- '(notmuch-search-font-lock-keywords t)))\r
++ (setq buffer-read-only t))\r
+ \r
+ (defun notmuch-search-find-thread-id ()\r
+ "Return the thread for the current thread"\r
+@@ -1487,6 +1484,30 @@ This function advances the next thread when finished."\r
+ (if never-found-target-thread\r
+ (goto-char notmuch-search-target-position)))))))\r
+ \r
++(defun insert-tags (tags)\r
++ (insert (concat "(" (propertize tags\r
++ 'font-lock-face 'notmuch-tag-face) ")")))\r
++\r
++(defun insert-field (field date count authors subject tags)\r
++(if (string-equal field "date")\r
++ (insert (format (cdr (assoc field notmuch-search-result-format)) date))\r
++ (if (string-equal field "count")\r
++ (insert (format (cdr (assoc field notmuch-search-result-format)) count))\r
++ (if (string-equal field "authors")\r
++ (insert (format (cdr (assoc field notmuch-search-result-format)) authors))\r
++ (if (string-equal field "subject")\r
++ (insert (format (cdr (assoc field notmuch-search-result-format)) subject))\r
++ (if (string-equal field "tags")\r
++ (insert-tags (format "%s" tags)))\r
++)))))\r
++\r
++(defun notmuch-search-show-result (date count authors subject tags)\r
++(let ((fields) (field))\r
++ (setq fields (mapcar 'car notmuch-search-result-format))\r
++ (loop for field in fields\r
++ do (insert-field field date count authors subject tags)))\r
++(insert "\n"))\r
++\r
+ (defun notmuch-search-process-filter (proc string)\r
+ "Process and filter the output of \"notmuch search\""\r
+ (let ((buffer (process-buffer proc))\r
+@@ -1510,7 +1531,7 @@ This function advances the next thread when finished."\r
+ (set 'authors (concat (substring authors 0 (- 40 3)) "...")))\r
+ (goto-char (point-max))\r
+ (let ((beg (point-marker)))\r
+- (insert (format "%s %-7s %-40s %s (%s)\n" date count authors subject tags))\r
++ (notmuch-search-show-result date count authors subject tags)\r
+ (put-text-property beg (point-marker) 'notmuch-search-thread-id thread-id)\r
+ (put-text-property beg (point-marker) 'notmuch-search-authors authors)\r
+ (put-text-property beg (point-marker) 'notmuch-search-subject subject)\r
+-- \r
+1.7.0.2.157.gb7e7f\r
+\r