unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* post-tag hook?
@ 2015-02-25  0:34 Christophe-Marie Duquesne
  2015-02-25  6:36 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe-Marie Duquesne @ 2015-02-25  0:34 UTC (permalink / raw)
  To: notmuch

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

Hi,

Is there a way to run a command every time a message gets tagged?

I would like to keep in sync tags and folder names. The problem is that it
requires a full scan of the notmuch db, which is slow. If I was running
this script only on messages that got retagged since like run of my script
it would be much faster. Unfortunately I don't find a way to mark/save
these messages in a notmuch hook.

I found an old thread from 2012, where somebody mentionned they implemented
a post-tag hook. Was this ever integrated?

Cheers,
Christophe-Marie

[-- Attachment #2: Type: text/html, Size: 602 bytes --]

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

* Re: post-tag hook?
  2015-02-25  0:34 post-tag hook? Christophe-Marie Duquesne
@ 2015-02-25  6:36 ` David Bremner
  2015-02-25  8:57   ` Christophe-Marie Duquesne
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2015-02-25  6:36 UTC (permalink / raw)
  To: Christophe-Marie Duquesne, notmuch

Christophe-Marie Duquesne <chmd@chmd.fr> writes:

>
> I would like to keep in sync tags and folder names. The problem is that it
> requires a full scan of the notmuch db, which is slow. If I was running
> this script only on messages that got retagged since like run of my script
> it would be much faster. Unfortunately I don't find a way to mark/save
> these messages in a notmuch hook.
>
> I found an old thread from 2012, where somebody mentionned they implemented
> a post-tag hook. Was this ever integrated?
>

I think the concensus was that we would rather go for tag "mtimes"
as started with the series

   id:1413181203-1676-1-git-send-email-aclements@csail.mit.edu

Unfortunately nobody yet found time to finish that series.

d

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

* Re: post-tag hook?
  2015-02-25  6:36 ` David Bremner
@ 2015-02-25  8:57   ` Christophe-Marie Duquesne
  2015-06-10 22:42     ` Daniel Schoepe
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe-Marie Duquesne @ 2015-02-25  8:57 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

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

Ah! Clever, I like the idea of using mtime.

[-- Attachment #2: Type: text/html, Size: 100 bytes --]

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

* Re: post-tag hook?
  2015-02-25  8:57   ` Christophe-Marie Duquesne
@ 2015-06-10 22:42     ` Daniel Schoepe
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Schoepe @ 2015-06-10 22:42 UTC (permalink / raw)
  To: Christophe-Marie Duquesne, David Bremner; +Cc: notmuch

Hi,

for what it's worth, you can simulate a post-tag hook in a somewhat ugly
way by putting a script called "notmuch" in front of the notmuch binary
in your PATH. The script can then call the original notmuch binary as
usual, inspect the first argument, and, if it's "tag", invoke your
script afterwards. I.e. something like this:

-------------------------------------
#!/bin/sh

/usr/bin/notmuch $@
retval=$?
if [[ "$1" == "tag" ]]; then
   shift 1
   your-script $@
fi
exit $retval
-------------------------------------

On a more general note, I'm experimenting with a way to synchronize tags
by logging and replaying tag commands performed on other machines and
for such an approach a post-tag hook would help. It seems to me that not
all use cases for a post-tag hook can be handled as nicely with mtimes.

Best regards,
Daniel

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

end of thread, other threads:[~2015-06-10 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25  0:34 post-tag hook? Christophe-Marie Duquesne
2015-02-25  6:36 ` David Bremner
2015-02-25  8:57   ` Christophe-Marie Duquesne
2015-06-10 22:42     ` Daniel Schoepe

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