Re: Create tags from folders

2022-08-08 Thread Reto
On Mon, Aug 08, 2022 at 10:39:36PM -0300, David Bremner wrote:
> e.g. query:python as
> 'folder:reto@labrat.space/INBOX.lists.python-list'
> This has the advantage that you don't have to retag when new files are
> added, which is often the desired behaviour.

Thanks, I do use queries for some things.

I anyhow have a tagging script to do the initial tagging
(also does some relatively naive spam removal, archiving of older
messages, kill lists etc).

Complicated queries just split the config in two then, some logic would
be in the tagging script and other things in the config, which I find
personally a step back rather than an improvement.
Especially as I will have to archive the inboxes at one point or another,
making the folder query fail (or me having to specify the archive dir in
the folder query as well).

Out of interest, how does your workflow look like?
All based on folder queries?

Greetings,
Reto
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Create tags from folders

2022-08-08 Thread David Bremner
Reto  writes:

>
> Second, I let notmuch index multiple email addresses in the same store,
> meaning my folder queries are then nested rather deep.
>
> So my lovely tag:python query amounts to `notmuch search 
> 'folder:reto@labrat.space/INBOX.lists.python-list'`
>
> Which... is a mouthful.
>
> Regexes aren't a solution, just makes it now two problems as I have
> multiple python lists that could match ;)

Just in case you didn't know, another option is define (with notmuch
config) e.g. query:python as
'folder:reto@labrat.space/INBOX.lists.python-list'

This has the advantage that you don't have to retag when new files are
added, which is often the desired behaviour.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Create tags from folders

2022-08-08 Thread Reto
On Mon, Aug 08, 2022 at 05:30:29PM +0300, Tomi Ollila wrote:
> On Sun, Aug 07 2022, Notmuch mailinglist wrote:
> 
> It is kinda duplicate information to have mail tagged with same name
> as the folder it is located in... but there may be reasons one would
> like to do such a thing -- and at least I am interested (at least a bit)
> why.

Well, for starters folders may change (say archiving those on the
imap side), the semantic tags do not.

Second, I let notmuch index multiple email addresses in the same store,
meaning my folder queries are then nested rather deep.

So my lovely tag:python query amounts to `notmuch search 
'folder:reto@labrat.space/INBOX.lists.python-list'`

Which... is a mouthful.

Regexes aren't a solution, just makes it now two problems as I have
multiple python lists that could match ;)

Cheers,
Reto

PS: not op, but also re-tagging even though I have emails filtered to
dedicated folders via sieve.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 6/9] test: Add test cases for new exclude option

2022-08-08 Thread Mohsin Kaleem
Tomi Ollila  writes:

> It looks like tab width was not 8 when these (notmuch-search-toggle-exclude)
> were added, accidentally indented w/ leading space, not tab ;/
>
> (ditto for all other (notmuch-search-toggle-exclude), rest of the content
> removed.)

Ah, good job spotting this. My tab width defaults to 2 in sh-script
files. I've fixed this now, but now sure what to do next. Should I
generate a new patch series and send them all again, generate a new
patch series and just send the modified patch, or is there some other
convention for next steps?

> Otherwise, in this large set of changes, I could not see anything alarming,
> but I did not test (I even don't know how, as I don't have excludes...)

An easy way to test would be to set some excluded tags :-).

notmuch config set search.exclude_tags foo

Then:
1. Go to your inbox in Emacs.
2. Tag some mail with foo.
3. Run `M-x notmuch-refresh-this-buffer` and the mail you tagged should
   no longer be shown.
4. Hit the i key and it will be shown again.
5. Hit i again and it will be hidden.
6. Hit i again to re-show it and go ahead and remove the foo tag
7. Run `M-x notmuch-refresh-this-buffer` or hit i as much as you like,
   the mail should now always be shown since its no longer excluded.

-- 
Mohsin Kaleem
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Create tags from folders

2022-08-08 Thread Thomas Schneider
Hi,

Notmuch mailinglist  writes:

> My email is from Protonmail and I use sieve filters to organise my mail as 
> needed into folders.
> Mbsync creates a folder structure which mirrors what is on my proton mail 
> account.
> But is it possible for notmuch to create tags based on the folders within my 
> mail directory and tagging the mails..

I have a very similar setup, and used to have custom filters for afew,
but eventually replaced it with a much simpler standalone script.  It’s
available online at [0].

For some junk residing in my dotfiles, it’s surprisingly well
documented, but if you don’t understand something just hmu.

I should probably rewrite it to the new python bindings … later …

--Thomas

[0]: 
https://github.com/qsuscs/.dotfiles/blob/7aa3b36e8e43ad0e928eddb60317a77e4bedd0a1/dot.local-bin-nm--tagger
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH 6/9] test: Add test cases for new exclude option

2022-08-08 Thread Tomi Ollila
On Sun, Aug 07 2022, Mohsin Kaleem wrote:

> ---
>  test/T461-emacs-search-exclude.sh | 99 +++
>  .../notmuch-search-tag-inbox-with-excluded| 25 +
>  .../notmuch-search-tag-inbox-without-excluded | 21 
>  .../notmuch-tree-tag-inbox-with-excluded  | 53 ++
>  .../notmuch-tree-tag-inbox-without-excluded   | 49 +
>  5 files changed, 247 insertions(+)
>  create mode 100755 test/T461-emacs-search-exclude.sh
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-search-tag-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-search-tag-inbox-without-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-with-excluded
>  create mode 100644 
> test/emacs-exclude.expected-output/notmuch-tree-tag-inbox-without-excluded
>
> diff --git a/test/T461-emacs-search-exclude.sh 
> b/test/T461-emacs-search-exclude.sh
> new file mode 100755
> index ..bf558847
> --- /dev/null
> +++ b/test/T461-emacs-search-exclude.sh
> @@ -0,0 +1,99 @@
> +#!/usr/bin/env bash
> +
> +test_description="exclude options persist between Emacs search and tree 
> modes"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
> +
> +EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
> +
> +test_require_emacs
> +add_email_corpus
> +notmuch config set search.exclude_tags deleted
> +notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
> +
> +# Basic test cases just asserting exclude option is working and consistent.
> +
> +test_begin_subtest "Search doesn't contain excluded mail by default"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> + (test-output)
> + (delete-other-windows)'
> +test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded 
> OUTPUT
> +
> +test_begin_subtest "Toggling exclude in search will show excluded mail"
> +test_emacs '(notmuch-hello)
> + (goto-char (point-min))
> + (re-search-forward "inbox")
> + (widget-button-press (1- (point)))
> + (notmuch-test-wait)
> +  (notmuch-search-toggle-exclude)

It looks like tab width was not 8 when these (notmuch-search-toggle-exclude)
were added, accidentally indented w/ leading space, not tab ;/

(ditto for all other (notmuch-search-toggle-exclude), rest of the content
removed.)

> + (notmuch-test-wait)

Otherwise, in this large set of changes, I could not see anything alarming,
but I did not test (I even don't know how, as I don't have excludes...)

Tomi
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: matching both accented and non-accented character for non-accented characters?

2022-08-08 Thread David Bremner
Bence Ferdinandy  writes:

> Thanks! I didn't know unicode equivalence existed, but it seems to be the
> feature I want, so at least now I have a name for it :) And yes, actually
> setting the stemmer would also be cool, I saw that Xapian has a Hungarian
> stemmer but I kind of assumed all stemmers are applied somehow (although it
> makes sense they're not). Is stemming done during search or would it affect
> the database as well? Just to have a notion of how complicated a settable
> stemmer feature would be.
>

Stemming happens both during search (unless turned off for given term)
and at indexing time. So yeah, changing the stemming algorithm with
change the database (and require a re-index).
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: matching both accented and non-accented character for non-accented characters?

2022-08-08 Thread Bence Ferdinandy
Thanks! I didn't know unicode equivalence existed, but it seems to be the
feature I want, so at least now I have a name for it :) And yes, actually
setting the stemmer would also be cool, I saw that Xapian has a Hungarian
stemmer but I kind of assumed all stemmers are applied somehow (although it
makes sense they're not). Is stemming done during search or would it affect
the database as well? Just to have a notion of how complicated a settable
stemmer feature would be.

David Bremner  ezt írta (időpont: 2022. aug. 8., H,
16:58):

> Bence Ferdinandy  writes:
>
> > Hi,
> >
> > I'm in the process of trying to set up reading email in the terminal and
> > just installed notmuch, which looks like a pretty awesome tool. I
> currently
> > have one question nagging me:
> >
> > I have a lot of mail in my native Hungarian, which properly written is
> full
> > of characters like éáűúü, but if someone's writing on a non-Hungarian
> > keyboard, or just quickly writing an email from a phone, they often drop
> > the accents as it's faster and we'll likely understand anyway. Is it
> > possible to set it up that if I search for "lanc" it would also match
> > "lánc" other than going `notmuch search lanc OR lánc`?
>
> There is some previous discussion at
>
>
> https://nmbug.notmuchmail.org/nmweb/search/id%3A87efp2b9er.fsf%40tethera.net
>
> I don't think anyone worked on this in the meantime, so I guess the
> short answer is that there is currently no support, but people have
> tossed around some ideas.
>
> d
>


-- 
+36305425054
bence.ferdinandy.com
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: matching both accented and non-accented character for non-accented characters?

2022-08-08 Thread David Bremner
Bence Ferdinandy  writes:

> Hi,
>
> I'm in the process of trying to set up reading email in the terminal and
> just installed notmuch, which looks like a pretty awesome tool. I currently
> have one question nagging me:
>
> I have a lot of mail in my native Hungarian, which properly written is full
> of characters like éáűúü, but if someone's writing on a non-Hungarian
> keyboard, or just quickly writing an email from a phone, they often drop
> the accents as it's faster and we'll likely understand anyway. Is it
> possible to set it up that if I search for "lanc" it would also match
> "lánc" other than going `notmuch search lanc OR lánc`?

There is some previous discussion at

  
https://nmbug.notmuchmail.org/nmweb/search/id%3A87efp2b9er.fsf%40tethera.net

I don't think anyone worked on this in the meantime, so I guess the
short answer is that there is currently no support, but people have
tossed around some ideas.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Create tags from folders

2022-08-08 Thread Tomi Ollila
On Sun, Aug 07 2022, Notmuch mailinglist wrote:

> Hello,
>
> I've managed to get mbsync, notmuch and neomutt all setup. But its now time 
> for fine tuning and tinkering.
> My email is from Protonmail and I use sieve filters to organise my mail as 
> needed into folders.
> Mbsync creates a folder structure which mirrors what is on my proton mail 
> account.
> But is it possible for notmuch to create tags based on the folders within my 
> mail directory and tagging the mails..
>
> Basically what I want is
> "if mail in folder1 tag as folder1"
>
> Hope this makes sense.

The question one can make based on the other reply is why tag based on
folders, and just not use folder queries finding the mails in these
folders.

It is kinda duplicate information to have mail tagged with same name
as the folder it is located in... but there may be reasons one would
like to do such a thing -- and at least I am interested (at least a bit)
why.

Tomi

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] WIP: provide relative lastmod sexp queries

2022-08-08 Thread David Bremner
---

I haven't looked carefully at how much work it would be to add to the
infix parser yet. I suspect it means adding a new RangeProcessor class
modelled on ParseTimeRangeProcessor. Maybe some of the logic from
_parse_sexp_range could be shared with the other parser.

 lib/parse-sexp.cc  | 6 ++
 test/T570-revision-tracking.sh | 8 
 2 files changed, 14 insertions(+)

diff --git a/lib/parse-sexp.cc b/lib/parse-sexp.cc
index 0f14d8b7..e9ef4268 100644
--- a/lib/parse-sexp.cc
+++ b/lib/parse-sexp.cc
@@ -575,6 +575,9 @@ _sexp_parse_range (notmuch_database_t *notmuch,  const 
_sexp_prefix_t *prefix,
return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;
}
 
+   if (from_idx < 0)
+   from_idx += notmuch_database_get_revision (notmuch, NULL);
+
try {
if (EMPTY_STRING (to))
to_idx = LONG_MAX;
@@ -585,6 +588,9 @@ _sexp_parse_range (notmuch_database_t *notmuch,  const 
_sexp_prefix_t *prefix,
return NOTMUCH_STATUS_BAD_QUERY_SYNTAX;
}
 
+   if (to_idx < 0)
+   to_idx += notmuch_database_get_revision (notmuch, NULL);
+
output = Xapian::Query (Xapian::Query::OP_VALUE_RANGE, 
NOTMUCH_VALUE_LAST_MOD,
Xapian::sortable_serialise (from_idx),
Xapian::sortable_serialise (to_idx));
diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh
index e1cc684d..aaa45468 100755
--- a/test/T570-revision-tracking.sh
+++ b/test/T570-revision-tracking.sh
@@ -95,4 +95,12 @@ subtotal=$(notmuch count lastmod:..$lastmod)
 result=$(($subtotal == $total-1))
 test_expect_equal 1 "$result"
 
+if [ $NOTMUCH_HAVE_SFSEXP -eq 1 ]; then
+test_begin_subtest 'exclude one message using negative lastmod (sexp)'
+total=$(notmuch count '*')
+notmuch tag +${RANDOM} id:4efc743a.3060...@april.org
+count=$(notmuch count --query=sexp '(lastmod -1 *)')
+test_expect_equal 1 "$count"
+fi
+
 test_done
-- 
2.35.2

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org