unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: inwit <inwit@sindominio.net>, notmuch@notmuchmail.org
Subject: Re: Folder+tags
Date: Sun, 03 Jan 2021 22:01:35 +0200	[thread overview]
Message-ID: <m25z4dpz6o.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <C89Q3K1O14PW.PZ8HI9HPOBI3@bisio>

On Sun, Jan 03 2021, inwit@sindominio.net wrote:

> On Sun Dec 27, 2020 at 10:09 PM CET, Tomi Ollila wrote:
>> On Sun, Dec 27 2020, inwit@sindominio.net wrote:
>> > On Sun Dec 27, 2020 at 2:12 PM CET, Tomi Ollila wrote:
>> >> On Sun, Dec 27 2020, inwit@sindominio.net wrote:
>> >>
>> >> There sure is notmuch-after-tag-hook (in emacs MUA), but -hooks
>> >> don't take argument(s) so how does it know what was tagged (cannot
>> >> remember if there are let-bound (dynamically bound!) variables that
>> >> could have such information).
>> > Apparently (I'm a total noob wrt elisp), the hook should know what
>> > was tagged and how it was tagged. In its documentation it reads:
>> > «'tag-changes' will contain the tags that were added or removed as a
>> > list of strings of the form "+TAG" or "-TAG". 'query' will be a
>> > string containing the search query that determines the messages that
>> > were tagged."
>>
>> nos that you said it, query is a variable the hook can access to know
>> what was tgged. filnames it doesn't contain. with the query you can
>> find the filenames with 'notmuch search --output=files query
> Coming back to this issue, I was wondering if someone could give me some
> advice concerning the notmuch-after-tag-hook (I've tried to find answers
> in the docs but I failed). 
>
> What I need to know is if, as with pre and post-new, I can write such
> hooks in any language (bash would be my choice at the moment) or they
> are limited to lisp? In the case I can use bash, how would I access to
> 'tag-changes' and 'query'?

The hooks are lisp code, the variables 'tag-changes' and 'query' are
available in the scope when those hooks are called (bound dynamically).

In your hook you can run shell command (if you wanted to run bash command
line)...

to see some samples how you'd do something like that run e.g. 
git grep shell-command  in notmuch source tree and examine found content...

> Also, where should I place my hook once written? 

in .emacs.d/notmuch-config.el

>
> Thanks for your patience.

sure, No prob. 

Tomi

      reply	other threads:[~2021-01-03 20:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 11:53 Folder+tags inwit
2020-12-24 13:59 ` Folder+tags Alan Schmitt
2020-12-25 16:41   ` Folder+tags inwit
2020-12-25  8:04 ` Folder+tags Jaume Devesa
2020-12-25 17:27   ` Folder+tags inwit
2020-12-27 11:59 ` Folder+tags inwit
2020-12-27 13:12   ` Folder+tags Tomi Ollila
2020-12-27 17:14     ` Folder+tags inwit
2020-12-27 21:09       ` Folder+tags Tomi Ollila
2020-12-28 16:51         ` Folder+tags inwit
2021-01-03 18:09         ` Folder+tags inwit
2021-01-03 20:01           ` Tomi Ollila [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m25z4dpz6o.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=inwit@sindominio.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).