[notmuch] [PATCH] notmuch: Add search mode hook
Aneesh Kumar K.V
aneesh.kumar at linux.vnet.ibm.com
Wed Nov 18 20:55:37 PST 2009
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 <aneesh.kumar at linux.vnet.ibm.com>
CC:Keith Packard <keithp at keithp.com>
---
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
More information about the notmuch
mailing list