[notmuch] [PATCH] notmuch: Add search mode hook
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Thu, 19 Nov 2009 04:55:37 +0000 (10:25 +0530)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:36 +0000 (09:35 -0800)
ea/228e735346956bf4d8fb9e816a8cba87d48a2e [new file with mode: 0644]

diff --git a/ea/228e735346956bf4d8fb9e816a8cba87d48a2e b/ea/228e735346956bf4d8fb9e816a8cba87d48a2e
new file mode 100644 (file)
index 0000000..87db392
--- /dev/null
@@ -0,0 +1,127 @@
+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 421CE431FBC\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 20:55:48 -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 IBcWxqFRjtjy for <notmuch@notmuchmail.org>;\r
+       Wed, 18 Nov 2009 20:55:47 -0800 (PST)\r
+Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1639E431FAE\r
+       for <notmuch@notmuchmail.org>; Wed, 18 Nov 2009 20:55:46 -0800 (PST)\r
+Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246])\r
+       by e23smtp08.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAJ4tj0I001237\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:55:45 +1100\r
+Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97])\r
+       by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id\r
+       nAJ4qQsN856092\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:52:26 +1100\r
+Received: from d23av03.au.ibm.com (loopback [127.0.0.1])\r
+       by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id\r
+       nAJ4tis2031704\r
+       for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 15:55:45 +1100\r
+Received: from localhost.localdomain (N20wks267599wss.in.ibm.com\r
+       [9.124.31.111])\r
+       by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id\r
+       nAJ4th5Y031698; Thu, 19 Nov 2009 15:55:44 +1100\r
+From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>\r
+To: notmuch@notmuchmail.org\r
+Date: Thu, 19 Nov 2009 10:25:37 +0530\r
+Message-Id:\r
+ <1258606537-12566-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: Add search mode hook\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: Thu, 19 Nov 2009 04:55:48 -0000\r
+\r
+This patch add notmuch-search-mode-hook and rename\r
+notmuch-show-hook to notmuch-show-mode-hook. This\r
+also runs notmuch-show-mode-hook when we enable\r
+notmuch-show-mode\r
+\r
+Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\r
+CC:Keith Packard <keithp@keithp.com>\r
+---\r
+ notmuch.el |   20 +++++++++++++++-----\r
+ 1 files changed, 15 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index 706e9f3..2f11b2b 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -640,7 +640,8 @@ 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
++  (run-hooks 'notmuch-show-mode-hook))\r
\r
+ ;;;###autoload\r
\r
+@@ -648,19 +649,28 @@ view, (remove the \"inbox\" tag from each), with\r
+   "Notmuch mail reader for Emacs."\r
+   :group 'mail)\r
\r
+-(defcustom notmuch-show-hook nil\r
++(defcustom notmuch-show-mode-hook nil\r
+   "List of functions to call when notmuch displays a message."\r
+   :type 'hook\r
+   :options '(goto-address)\r
+   :group 'notmuch)\r
\r
++(defcustom notmuch-search-mode-hook nil\r
++  "List of functions to call when notmuch displays the search results."\r
++  :type 'hook\r
++  :options '(hl-line-mode)\r
++  :group 'notmuch)\r
++\r
+ ; Make show mode a bit prettier, highlighting URLs and using word wrap\r
\r
+ (defun notmuch-show-pretty-hook ()\r
+   (goto-address-mode 1)\r
+   (visual-line-mode))\r
\r
+-(add-hook 'notmuch-show-hook 'notmuch-show-pretty-hook)\r
++(add-hook 'notmuch-show-mode-hook 'notmuch-show-pretty-hook)\r
++(add-hook 'notmuch-search-mode-hook \r
++        (lambda()\r
++          (hl-line-mode 1) ))\r
\r
+ (defun notmuch-show (thread-id &optional parent-buffer)\r
+   "Run \"notmuch show\" with the given thread ID and display results.\r
+@@ -684,7 +694,6 @@ thread from that buffer can be show when done with this one)."\r
+       (call-process "notmuch" nil t nil "show" thread-id)\r
+       (notmuch-show-markup-messages)\r
+       )\r
+-      (run-hooks 'notmuch-show-hook)\r
+       ; Move straight to the first unread message\r
+       (if (not (notmuch-show-message-unread-p))\r
+         (progn\r
+@@ -787,7 +796,8 @@ 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
++  (run-hooks 'notmuch-search-mode-hook))\r
\r
+ (defun notmuch-search-find-thread-id ()\r
+   (save-excursion\r
+-- \r
+1.6.5.2.74.g610f9\r
+\r