unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch: Add hooks for show-mode and search-mode
@ 2009-11-18 15:14 Aneesh Kumar K.V
  2009-11-18 23:44 ` Carl Worth
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2009-11-18 15:14 UTC (permalink / raw)
  To: notmuch


From e3a801c90ed5e037b68bd16807606388e6dbe6e8 Mon Sep 17 00:00:00 2001
From: Aneesh Kumar K.V <aneesh.kumar@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@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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-18 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18 15:14 [PATCH] notmuch: Add hooks for show-mode and search-mode Aneesh Kumar K.V
2009-11-18 23:44 ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).