Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trash threads in index and view modes #589

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

e11o
Copy link

@e11o e11o commented Oct 29, 2018

Just added the ability to trash threads (toggle 'trash' tag) in index and view modes.

Added potential keybindings following the pattern for archiving threads (which I consider to be the closest action in nature) but left most unbound because it looked a bit overkill and didn't want to take over all remaining keys. In the only few places where I bound a key, I used GDK_KEY_Delete (as "d" and "t" were already taken).

@gauteh
Copy link
Member

gauteh commented Oct 29, 2018 via email

@mxmehl
Copy link
Contributor

mxmehl commented Oct 29, 2018

Since you asked for others' experiences: I personally also use the tag del to move things to the trash bin after the next run of poll.sh and a custom script which takes care of moving mails based on their tags.

The same applies to the spam tag which I also use frequently, and for which there is already a built-in keybinding (which I changed).

Obviously, the del and spam tags are excluded tags within notmuch.

For actually deleting single emails within threads, for example vacation auto-replies, I use a hook.

I'm not using the archive tag at all so I can't say anything about its usage in astroid or notmuch.

@e11o
Copy link
Author

e11o commented Oct 29, 2018

To me, it's almost the same concept as archiving (removing the "inbox" tag). It would work out of the box with some servers (like Gmail) but will need some wrangling with others (Office365, anyone?). For the second case, it would at least mark the threads so something else (like alot) can pick them up.

I don't think all functionality can be implemented right now via hooks. For example

  • Delete and close in thread_view mode
  • Toggling ("t") multiple threads in thread_index mode and deleting them together.

If we want to be on the safer side, we can leave all actions with unbound keys and document for those who want the feature. Probably no one would use Delete or BackSpace for this anyway ("d" is much more appealing) so they will need to config keybindings anyway.

@@ -1385,6 +1385,20 @@ namespace Astroid {
return true;
});

keys.register_key (Key (GDK_KEY_BackSpace),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it sometimes Backspace and sometimes Delete? Should always be the same I think. I think that we can use d

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look again but I believe d is already taken in the default keybindings for one of the modes.

@varac
Copy link

varac commented Jan 5, 2020

@e11o What's the state of the PR ? @gauteh proposed changes to your PR, can you please consider them so we can merge this ?

@e11o
Copy link
Author

e11o commented Apr 4, 2020

Sorry that I totally dropped the ball here but I will complete the PR now. There's a case that doesn't work as expected though.

Previously trashed threads will appear again in the thread index when a new email is added to the thread. This is desired behavior.

But I would expect thrashing would just trash the thread again but, as it's implemented using a ToggleAction, it will actually delete the existing trash tag. You need to trash twice to delete the thread.

On the other hand, there might be a valid use case for removing the trash tag in thread index mode. As trash would typically be added to search.exclude_tags in notmuch, this use case would be when searching explicitly with tag:trash. Restoring emails is probably the most common scenario.

So it seems like the action in thread_index needs to be contextual and never a toggle. If tag:trash is present in the search string then it should remove the trash tag. If tag:trash is not present then it should remove and add the tag again?

@gauteh Does that make sense? Is it possible to know tags in the search string when executing an action?

@gauteh
Copy link
Member

gauteh commented Apr 11, 2020

Would it make sense to:

if all messages has trash: untrash
if some, but not all, or none has trash: trash

this seems to give the same behavior, and I think would be more deterministic.

@e11o
Copy link
Author

e11o commented Apr 11, 2020

I like it better, yes.

Alternatively, could use a binding for sending to trash and another for restoring. Both would be no-op in case there's nothing to trash or restore.

Would be more explicit but requires 2 bindings...

@e11o
Copy link
Author

e11o commented Apr 18, 2020

@gauteh I updated the key bindings to use "d". Had to also use Delete for one particular case.

Regarding the if all messages has trash: untrash approach, I originally thought you were refering to "all selected messages" but that wouldn't resolve the problem.
Now I believe you were referring to check all threads in the list store. Wouldn't that be very inefficient for a large result set?

@varac
Copy link

varac commented May 3, 2020

@gauteh Lets get this merged soon please, waiting for this feature ! Thanks !

@gauteh
Copy link
Member

gauteh commented May 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants