Patchworkβ [3/3] Add notmuch-hello-mode-hook

login
register
about
Submitter Ivy Foster
Date 2011-10-29 16:35:04
Message ID <87hb2rlps7.fsf@nausicaa.localdomain>
Download mbox | patch
Permalink /patch/1434/
State New
Headers show

Comments

Ivy Foster - 2011-10-29 16:35:04
The following patch adds a mode-hook to notmuch-hello-mode.
Not much else to say, really.

Would people find hooks for before and/or after adding the
tags useful? Or hooks elsewhere in this mode (or other
modes)?

iff

Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us>
From e8cdead0222fc85dd01d8a0185b54aed5e0a6e1e Mon Sep 17 00:00:00 2001
From: Ivy Foster <joyfulgirl@archlinux.us>
Date: Fri, 28 Oct 2011 23:47:16 -0400
Subject: [PATCH 3/3] Added notmuch-hello-mode-hook

---
 emacs/notmuch-hello.el |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Thomas Jost - 2011-10-30 10:06:38
On Sat, 29 Oct 2011 12:35:04 -0400, Ivy Foster <joyfulgirl@archlinux.us> wrote:
> The following patch adds a mode-hook to notmuch-hello-mode.
> Not much else to say, really.

I agree it's useful, but
id:"1317643438-31272-5-git-send-email-schnouki@schnouki.net" ;)
(the hooks are not run from the same place though)

> Would people find hooks for before and/or after adding the
> tags useful?

There are such hooks already: notmuch-{after,before}-tag-hook. Or do you
mean something different?

Regards,
Ivy Foster - 2011-10-30 15:54:07
On Sun, 30 Oct 2011 11:06:38 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> On Sat, 29 Oct 2011 12:35:04 -0400, Ivy Foster <joyfulgirl@archlinux.us> wrote:
> > The following patch adds a mode-hook to
> > notmuch-hello-mode. Not much else to say, really.

> I agree it's useful, but
> id:"1317643438-31272-5-git-send-email-schnouki@schnouki.net"
> ;) (the hooks are not run from the same place though)

Hmm, good point. Whoops again. I guess the question comes
down to run-hooks or run-mode-hooks, then. I'll be sure to
be more careful about browsing through the archive first, in
the future.

> > Would people find hooks for before and/or after adding
> > the tags useful?

> There are such hooks already:
> notmuch-{after,before}-tag-hook. Or do you mean something
> different?

Oh, I meant populating the hello buffer with the list of
tags, not around adding or removing a message's tags.

iff
Daniel Schoepe - 2011-10-30 23:37:05
On Sun, 30 Oct 2011 11:54:07 -0400, Ivy Foster <joyfulgirl@archlinux.us> wrote:
> Oh, I meant populating the hello buffer with the list of
> tags, not around adding or removing a message's tags.

I sent a patch[1] a while ago that changes notmuch-hello such that the
buffer contents are generated by a customizable list of functions. This
would also allow to execute arbitrary functions around the ones that
generate such tag lists thus eliminating the need for these hooks, if I
understand their intended purpose correctly.

[1] Latest version: id:"1318253982-23588-1-git-send-email-daniel@schoepe.org"

Cheers,
Daniel
Pieter Praet - 2011-11-11 01:54:30
On Sun, 30 Oct 2011 11:54:07 -0400, Ivy Foster <joyfulgirl@archlinux.us> wrote:
> On Sun, 30 Oct 2011 11:06:38 +0100, Thomas Jost <schnouki@schnouki.net> wrote:
> > On Sat, 29 Oct 2011 12:35:04 -0400, Ivy Foster <joyfulgirl@archlinux.us> wrote:
> > > The following patch adds a mode-hook to
> > > notmuch-hello-mode. Not much else to say, really.
> 
> > I agree it's useful, but
> > id:"1317643438-31272-5-git-send-email-schnouki@schnouki.net"
> > ;) (the hooks are not run from the same place though)
> 
> Hmm, good point. Whoops again. I guess the question comes
> down to run-hooks or run-mode-hooks, then. I'll be sure to
> be more careful about browsing through the archive first, in
> the future.
> 

Digging through the archive is *always* a good idea.
It's filled to the brim with treasure, waiting to be re-discovered ;)

Here's some more notmuch-hello-mode-hook patches from the past:
- id:"1278000507-22290-6-git-send-email-dmitry.kurochkin@gmail.com"
- id:"1312799218-10243-1-git-send-email-anarcat@koumbit.org"

> > > Would people find hooks for before and/or after adding
> > > the tags useful?
> 
> > There are such hooks already:
> > notmuch-{after,before}-tag-hook. Or do you mean something
> > different?
> 
> Oh, I meant populating the hello buffer with the list of
> tags, not around adding or removing a message's tags.
> 
> iff
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Peace

Patch

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 1a213f0..13356c5 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -118,6 +118,11 @@  Typically \",\" in the US and UK and \".\" in Europe."
   :group 'notmuch
   :type 'string)
 
+(defcustom notmuch-hello-mode-hook nil
+  "Functions called after entering `notmuch-hello-mode'."
+  :group 'notmuch
+  :type 'hook)
+
 (defvar notmuch-hello-url "http://notmuchmail.org"
   "The `notmuch' web site.")
 
@@ -337,6 +342,7 @@  Complete list of currently available key bindings:
  (use-local-map notmuch-hello-mode-map)
  (setq major-mode 'notmuch-hello-mode
        mode-name "notmuch-hello")
+ (run-mode-hooks 'notmuch-hello-mode-hook)
  ;;(setq buffer-read-only t)
 )