pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
683 stars 163 forks source link

Partially addresses 'alot refreshes search list during execution of command list' #769 #1592

Open naegling opened 2 years ago

naegling commented 2 years ago

Both the OP and my own issue involved atomically adding and removing tags that could effect the contents of search. This patch adds a new command applytags with arguments formatted as in notmuch tag command.

The OP's example:

[bindings]
    [[search]]
        delete = "tag deleted; untag undeleted,unread,inbox;"
        insert = "tag undeleted; untag deleted;"

could be configured as:

[bindings]
    [[search]]
        delete = "applytags +deleted -undeleted -unread -inbox;"
        insert = "applytags +undeleted -deleted;"
naegling commented 2 years ago

Well, that's annoying. I just noticed that the first argument to applytags has to be an added tag. Otherwise, its interpreted as a (invalid) command line option.

pazz commented 2 years ago

hehe yes, lols. never thought of that :D

kbingham commented 2 years ago

This is a really nice idea, I've also hit the tags affecting the wrong thread after a refresh.

naegling commented 2 years ago

Well, that's annoying. I just noticed that the first argument to applytags has to be an added tag. Otherwise, its interpreted as a (invalid) command line option.

Suppressing the option interpretation looks both invasive and hacky. Currently, I see 2 options for more consistent syntax. to remove the dick tag and add the jane tag:

  1. use a standalone + as a noop. applytags + -dick +jane.
  2. introduce an option name. applytags -ops -dick +jane. The option name could be optional, so that applytags +jane -dick would still work as before.

Comments Welcomed!

MacGyverNL commented 1 year ago

Currently, I see 2 options for more consistent syntax. to remove the dick tag and add the jane tag:

  1. The unix-standard -- to denote the end of an option list? I think argparse handles that as expected, per the documentation @ https://docs.python.org/3/library/argparse.html#arguments-containing. So that would become applytags -- -dick +jane. This should have the semantics of your 2. without needing code handling in alot itself.

I doubt people would mistake that as trying to remove the - tag as first argument.