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