[notmuch] [PATCH] notmuch: Add hooks for show-mode and search-mode

Aneesh Kumar K.V aneesh.kumar at linux.vnet.ibm.com
Wed Nov 18 07:14:58 PST 2009


>From e3a801c90ed5e037b68bd16807606388e6dbe6e8 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
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 <aneesh.kumar at linux.vnet.ibm.com>
---
 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



More information about the notmuch mailing list