unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Create tags from folders
@ 2022-08-07 19:18 Notmuch mailinglist
  2022-08-07 19:49 ` Reto
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Notmuch mailinglist @ 2022-08-07 19:18 UTC (permalink / raw)
  To: notmuch

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.

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

* Re: Create tags from folders
  2022-08-07 19:18 Create tags from folders Notmuch mailinglist
@ 2022-08-07 19:49 ` Reto
  2022-08-08 14:30 ` Tomi Ollila
  2022-08-08 18:50 ` Thomas Schneider
  2 siblings, 0 replies; 8+ messages in thread
From: Reto @ 2022-08-07 19:49 UTC (permalink / raw)
  To: Notmuch mailinglist; +Cc: notmuch

On Sun, Aug 07, 2022 at 07:18:48PM +0000, Notmuch mailinglist wrote:
> But is it possible for notmuch to create tags based on the folders within my mail directory and tagging the mails..

notmuch-search-terms(7)

folder:<maildir-folder> or folder:/<regex>/
	 The folder: prefix searches for email messages by maildir or MH folder.
	 For MH-style folders, this is equivalent to path:. For maildir, this includes messages in the "new"
	 and "cur" subdirectories. The exact syntax for maildir folders depends on your mail configuration.
	 For maildir++, folder:"" matches the inbox folder (which is the root in maildir++), other folder
	 names always start with ".", and nested folders are separated by "."s, such as
	 folder:.classes.topology. For "file system" maildir, the inbox is typically folder:INBOX and
	 nested folders are separated by slashes, such as folder:classes/topology.
	 folder: will find a message if any copy of that message is in the specific folder.

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

* Re: Create tags from folders
  2022-08-07 19:18 Create tags from folders Notmuch mailinglist
  2022-08-07 19:49 ` Reto
@ 2022-08-08 14:30 ` Tomi Ollila
  2022-08-08 22:10   ` Reto
  2022-08-08 18:50 ` Thomas Schneider
  2 siblings, 1 reply; 8+ messages in thread
From: Tomi Ollila @ 2022-08-08 14:30 UTC (permalink / raw)
  To: Notmuch mailinglist, notmuch

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

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

* Re: Create tags from folders
  2022-08-07 19:18 Create tags from folders Notmuch mailinglist
  2022-08-07 19:49 ` Reto
  2022-08-08 14:30 ` Tomi Ollila
@ 2022-08-08 18:50 ` Thomas Schneider
  2 siblings, 0 replies; 8+ messages in thread
From: Thomas Schneider @ 2022-08-08 18:50 UTC (permalink / raw)
  To: Notmuch mailinglist; +Cc: notmuch

Hi,

Notmuch mailinglist <notmuch.pbn7u@8shield.net> 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\r

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

* Re: Create tags from folders
  2022-08-08 14:30 ` Tomi Ollila
@ 2022-08-08 22:10   ` Reto
  2022-08-09  1:39     ` David Bremner
  0 siblings, 1 reply; 8+ messages in thread
From: Reto @ 2022-08-08 22:10 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: Notmuch mailinglist, notmuch

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.

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

* Re: Create tags from folders
  2022-08-08 22:10   ` Reto
@ 2022-08-09  1:39     ` David Bremner
  2022-08-09  5:58       ` Reto
  0 siblings, 1 reply; 8+ messages in thread
From: David Bremner @ 2022-08-09  1:39 UTC (permalink / raw)
  To: Reto, Tomi Ollila; +Cc: Notmuch mailinglist, notmuch

Reto <reto@labrat.space> 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

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

* Re: Create tags from folders
  2022-08-09  1:39     ` David Bremner
@ 2022-08-09  5:58       ` Reto
  2022-08-09 11:28         ` David Bremner
  0 siblings, 1 reply; 8+ messages in thread
From: Reto @ 2022-08-09  5:58 UTC (permalink / raw)
  To: David Bremner; +Cc: notmuch

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

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

* Re: Create tags from folders
  2022-08-09  5:58       ` Reto
@ 2022-08-09 11:28         ` David Bremner
  0 siblings, 0 replies; 8+ messages in thread
From: David Bremner @ 2022-08-09 11:28 UTC (permalink / raw)
  To: Reto; +Cc: notmuch

Reto <reto@labrat.space> writes:
>
> Out of interest, how does your workflow look like?
> All based on folder queries?

I don't use folders much anymore. My main searches are defined in terms
of List-ID ORed with tags to sort into mailing-list-like-things (as some
things I think should be part of the list are missing the List-ID
header).

d

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

end of thread, other threads:[~2022-08-09 11:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 19:18 Create tags from folders Notmuch mailinglist
2022-08-07 19:49 ` Reto
2022-08-08 14:30 ` Tomi Ollila
2022-08-08 22:10   ` Reto
2022-08-09  1:39     ` David Bremner
2022-08-09  5:58       ` Reto
2022-08-09 11:28         ` David Bremner
2022-08-08 18:50 ` Thomas Schneider

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