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 7DD8E431FBC for ; Wed, 18 Nov 2009 07:15:04 -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 bvGyeqzC8e89 for ; Wed, 18 Nov 2009 07:15:03 -0800 (PST) Received: from e23smtp06.au.ibm.com (e23smtp06.au.ibm.com [202.81.31.148]) by olra.theworths.org (Postfix) with ESMTP id 23E0A431FAE for ; Wed, 18 Nov 2009 07:15:02 -0800 (PST) Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp06.au.ibm.com (8.14.3/8.13.1) with ESMTP id nAIFExRC018885 for ; Thu, 19 Nov 2009 02:14:59 +1100 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nAIFBhIi1585350 for ; Thu, 19 Nov 2009 02:11:43 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nAIFF0Bf028507 for ; Thu, 19 Nov 2009 02:15:01 +1100 Received: from skywalker.linux.vnet.ibm.com ([9.77.125.7]) by d23av01.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nAIFEwlt028394 for ; Thu, 19 Nov 2009 02:15:00 +1100 From: aneesh.kumar@linux.vnet.ibm.com (Aneesh Kumar K.V) To: notmuch Date: Wed, 18 Nov 2009 20:44:58 +0530 Message-ID: <87my2jrhjh.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [notmuch] [PATCH] notmuch: Add hooks for show-mode and search-mode 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: Wed, 18 Nov 2009 15:15:04 -0000 >From e3a801c90ed5e037b68bd16807606388e6dbe6e8 Mon Sep 17 00:00:00 2001 From: Aneesh Kumar K.V Date: Wed, 18 Nov 2009 20:43:13 +0530 Subject: [PATCH] notmuch: Add hooks for show-mode and search-mode This enables to do things like (add-hook 'notmuch-search-mode-hook (lambda() (hl-line-mode 1) )) Signed-off-by: Aneesh Kumar K.V --- notmuch.el | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/notmuch.el b/notmuch.el index 014d15b..87116f9 100644 --- a/notmuch.el +++ b/notmuch.el @@ -57,6 +57,12 @@ "Keymap for \"notmuch show\" buffers.") (fset 'notmuch-show-mode-map notmuch-show-mode-map) +(defvar notmuch-show-mode-hook nil + "Hooks run when notmuch-show-mode is enabled") + +(defvar notmuch-search-mode-hook nil + "Hooks run when notmuch-search-mode is enabled") + (defvar notmuch-show-signature-regexp "\\(-- ?\\|_+\\)$" "Pattern to match a line that separates content from signature. @@ -636,7 +642,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)) (defun notmuch-show (thread-id &optional parent-buffer) "Run \"notmuch show\" with the given thread ID and display results. @@ -759,7 +766,8 @@ global search. (use-local-map notmuch-search-mode-map) (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