* [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
* Re: [PATCH] notmuch: Add hooks for show-mode and search-mode
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
0 siblings, 0 replies; 2+ messages in thread
From: Carl Worth @ 2009-11-18 23:44 UTC (permalink / raw)
To: Aneesh Kumar K.V, notmuch
On Wed, 18 Nov 2009 20:44:58 +0530, aneesh.kumar@linux.vnet.ibm.com (Aneesh Kumar K.V) wrote:
> 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) ))
Hi Aneesh,
Thanks for the patch. I think the hooks will be genuinely useful. I
haven't pushed this yet for two questions:
1. I recently merged an independent patch from Keith to add one hook
already. (And it looks like Keith got fancy and used defcustom instead
of defvar.) Could you re-do your patch on top of master and match the
style he used? [*]
2. If this hl-line-mode thing is interesting for you, might it not be
interesting for all users? (What does it do anyway?)
One concern I have with hooks is that people will use them to fix things
locally and prevent the defaults getting fixed to improve things for
everybody. (Granted, sometimes there's an honest difference of opinion,
so the defaults can't always satisfy everyone, and we'll want the
hooks.)
I guess I'm just hoping that people will at least attempt to get
improvements to be integrated into the defaults instead of just changing
local hooks.
-Carl
[*] Independently, it might be nice to switch all of our variables
intended to be tweaked by the user from defvar to defcustom.
^ permalink raw reply [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).