[notmuch] [PATCH -V2] notmuch.el: Support for customizing search result display
[notmuch-archives.git] / ea / 228e735346956bf4d8fb9e816a8cba87d48a2e
1 Return-Path: <aneesh.kumar@linux.vnet.ibm.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 421CE431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 20:55:48 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id IBcWxqFRjtjy for <notmuch@notmuchmail.org>;\r
11         Wed, 18 Nov 2009 20:55:47 -0800 (PST)\r
12 Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141])\r
13         by olra.theworths.org (Postfix) with ESMTP id 1639E431FAE\r
14         for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 20:55:46 -0800 (PST)\r
15 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
16         by e23smtp08.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAJ4tj0I001237\r
17         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:55:45 +1100\r
18 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97])\r
19         by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
20         nAJ4qQsN856092\r
21         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:52:26 +1100\r
22 Received: from d23av03.au.ibm.com (loopback [127.0.0.1])\r
23         by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
24         nAJ4tis2031704\r
25         for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:55:45 +1100\r
26 Received: from localhost.localdomain (N20wks267599wss.in.ibm.com\r
27         [9.124.31.111])\r
28         by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
29         nAJ4th5Y031698; Thu, 19 Nov 2009 15:55:44 +1100\r
30 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>\r
31 To: notmuch@notmuchmail.org\r
32 Date: Thu, 19 Nov 2009 10:25:37 +0530\r
33 Message-Id:\r
34  <1258606537-12566-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com>\r
35 X-Mailer: git-send-email 1.6.5.2.74.g610f9\r
36 Subject: [notmuch] [PATCH] notmuch: Add search mode hook\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.12\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Thu, 19 Nov 2009 04:55:48 -0000\r
50 \r
51 This patch add notmuch-search-mode-hook and rename\r
52 notmuch-show-hook to notmuch-show-mode-hook. This\r
53 also runs notmuch-show-mode-hook when we enable\r
54 notmuch-show-mode\r
55 \r
56 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
57 CC:Keith Packard <keithp@keithp.com>\r
58 ---\r
59  notmuch.el |   20 +++++++++++++++-----\r
60  1 files changed, 15 insertions(+), 5 deletions(-)\r
61 \r
62 diff --git a/notmuch.el b/notmuch.el\r
63 index 706e9f3..2f11b2b 100644\r
64 --- a/notmuch.el\r
65 +++ b/notmuch.el\r
66 @@ -640,7 +640,8 @@ view, (remove the \"inbox\" tag from each), with\r
67    (use-local-map notmuch-show-mode-map)\r
68    (setq major-mode 'notmuch-show-mode\r
69         mode-name "notmuch-show")\r
70 -  (setq buffer-read-only t))\r
71 +  (setq buffer-read-only t)\r
72 +  (run-hooks 'notmuch-show-mode-hook))\r
73  \r
74  ;;;###autoload\r
75  \r
76 @@ -648,19 +649,28 @@ view, (remove the \"inbox\" tag from each), with\r
77    "Notmuch mail reader for Emacs."\r
78    :group 'mail)\r
79  \r
80 -(defcustom notmuch-show-hook nil\r
81 +(defcustom notmuch-show-mode-hook nil\r
82    "List of functions to call when notmuch displays a message."\r
83    :type 'hook\r
84    :options '(goto-address)\r
85    :group 'notmuch)\r
86  \r
87 +(defcustom notmuch-search-mode-hook nil\r
88 +  "List of functions to call when notmuch displays the search results."\r
89 +  :type 'hook\r
90 +  :options '(hl-line-mode)\r
91 +  :group 'notmuch)\r
92 +\r
93  ; Make show mode a bit prettier, highlighting URLs and using word wrap\r
94  \r
95  (defun notmuch-show-pretty-hook ()\r
96    (goto-address-mode 1)\r
97    (visual-line-mode))\r
98  \r
99 -(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)\r
100 +(add-hook 'notmuch-show-mode-hook 'notmuch-show-pretty-hook)\r
101 +(add-hook 'notmuch-search-mode-hook \r
102 +         (lambda()\r
103 +           (hl-line-mode 1) ))\r
104  \r
105  (defun notmuch-show (thread-id &optional parent-buffer)\r
106    "Run \"notmuch show\" with the given thread ID and display results.\r
107 @@ -684,7 +694,6 @@ thread from that buffer can be show when done with this one)."\r
108         (call-process "notmuch" nil t nil "show" thread-id)\r
109         (notmuch-show-markup-messages)\r
110         )\r
111 -      (run-hooks 'notmuch-show-hook)\r
112        ; Move straight to the first unread message\r
113        (if (not (notmuch-show-message-unread-p))\r
114           (progn\r
115 @@ -787,7 +796,8 @@ global search.\r
116    (setq truncate-lines t)\r
117    (setq major-mode 'notmuch-search-mode\r
118         mode-name "notmuch-search")\r
119 -  (setq buffer-read-only t))\r
120 +  (setq buffer-read-only t)\r
121 +  (run-hooks 'notmuch-search-mode-hook))\r
122  \r
123  (defun notmuch-search-find-thread-id ()\r
124    (save-excursion\r
125 -- \r
126 1.6.5.2.74.g610f9\r
127 \r