[notmuch] [PATCH] notmuch: Add search mode hook

2009-11-19 Thread Aneesh Kumar K.V
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"  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



[notmuch] [PATCH] notmuch: Add search mode hook

2009-11-19 Thread Aneesh Kumar K.V
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 
CC:Keith Packard 
---
 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  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



[notmuch] [PATCH] notmuch: Add search mode hook

2009-11-18 Thread Keith Packard
On Thu, 19 Nov 2009 10:25:37 +0530, "Aneesh Kumar K.V"  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 at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: