unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch: Add search mode hook
@ 2009-11-19  4:55 Aneesh Kumar K.V
  2009-11-19  5:21 ` Keith Packard
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K.V @ 2009-11-19  4:55 UTC (permalink / raw)
  To: notmuch

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@linux.vnet.ibm.com>
CC:Keith Packard <keithp@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

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

* Re: [PATCH] notmuch: Add search mode hook
  2009-11-19  4:55 [PATCH] notmuch: Add search mode hook Aneesh Kumar K.V
@ 2009-11-19  5:21 ` Keith Packard
  2009-11-19  5:56   ` Aneesh Kumar K.V
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Packard @ 2009-11-19  5:21 UTC (permalink / raw)
  To: Aneesh Kumar K.V, notmuch

[-- Attachment #1: Type: text/plain, Size: 433 bytes --]

On Thu, 19 Nov 2009 10:25:37 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:

> 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

I'm not sure we want to run the hooks that early; I can easily imagine
hooks that want to be run after the message has been loaded.

--
keith.packard@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] notmuch: Add search mode hook
  2009-11-19  5:21 ` Keith Packard
@ 2009-11-19  5:56   ` Aneesh Kumar K.V
  0 siblings, 0 replies; 3+ messages in thread
From: Aneesh Kumar K.V @ 2009-11-19  5:56 UTC (permalink / raw)
  To: Keith Packard; +Cc: notmuch

On Wed, Nov 18, 2009 at 09:21:11PM -0800, Keith Packard wrote:
> On Thu, 19 Nov 2009 10:25:37 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
> 
> > 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
> 
> I'm not sure we want to run the hooks that early; I can easily imagine
> hooks that want to be run after the message has been loaded.

Ok i will move them and send another patch

-aneesh

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

end of thread, other threads:[~2009-11-19  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19  4:55 [PATCH] notmuch: Add search mode hook Aneesh Kumar K.V
2009-11-19  5:21 ` Keith Packard
2009-11-19  5:56   ` Aneesh Kumar K.V

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).