Re: [PATCH] emacs: add tag jump menu

Subject: Re: [PATCH] emacs: add tag jump menu

Date: Sun, 18 Sep 2016 17:30:29 +0300

To: Mark Walters, notmuch@notmuchmail.org

Cc:

From: Ioan-Adrian Ratiu


On Sun, 18 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
> On Sun, 18 Sep 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:
>> Hi
>>
>> I have implemented something similar in my tree and I really like the
>> idea. I have one issue though.
>>
>> On Sat, 17 Sep 2016, Mark Walters <markwalters1009@gmail.com> wrote:
>>> Add a "jump" style menu for doing tagging operations.
>>> ---
>>>
>>> Jani suggested something like this on irc today. This is a first cut
>>> to see if people like it. By default the tagging jump menu is bound to
>>> k (which works in search/show/tree mode), and has the following options
>>>
>>> a (Archive) -inbox -unread
>>> u (Mark Read) -unread
>>> d (Delete)  +deleted
>>>
>>> If you do ctrl-u k the it will do the reverse operation.
>>
>> I know C-u is default emacs behaviour but I find very cumbersone to do
>> C-u for unapplying the tag. What I do and want is to simply apply the
>> tag when pressing "d" then unapply it when pressing "d" again if the
>> mail/thread already contains the deleted tag (basically it's a toggle).
>
> I agree that C-u is a little cumbersome -- I think I would be happy for
> a toggle for single messages (with a single tag change), but for
> multiple messages like a thread I think it would be very unclear what it
> was doing.

My workflow with the kind of code shown above is as follows:

If in notmuch-search then pressing 'd' "deletes" everything selected,
including multiple messages in a region and if a thread was selected in
that region then the entire thread is deleted.

If I want to delete just a single message from the thread, I go to
notmuch-show where 'd' operates on a single message, never on a thread.

If an entire thread was already marked "deleted" and I want to undelete
a single message from that thread, I go to notmuch-show and press 'd' on
it.

IMO this is the simplest and the clearest workflow.

>
> In your example I think d on a thread with a deleted message would
> undelete the thread, rather than deleting the other messages in the
> thread. But whichever of the two we chose I could see people being
> unsure which it was going to do.
>
> It would be plausible to modify my patch so that k u does the same as
> Ctrl-u k (i.e. takes you to the reverse tag operations) which would
> avoid the awkward ctrl-u. (I don't want to add another key to the top
> level maps as we are really very short on free keys)

I agree to not pollute the top level maps and 'k u' would work for me,
what is important for me is to support toggling :) 

>
> Best wishes
>
> Mark
>
>
>
>
>> Here's an example of code I'm using:
>>
>> (define-key notmuch-show-mode-map "d"
>>       (lambda ()
>>         "toggle deleted tag for message"
>>         (interactive)
>>         (if (member "deleted" (notmuch-show-get-tags))
>>             (notmuch-show-tag (list "-deleted"))
>>           (notmuch-show-tag (list "+deleted")))))
>>
>> (define-key notmuch-search-mode-map "d"
>>   (lambda (&optional beg end)
>>         "toggle deleted tag for message"
>>         (interactive (notmuch-search-interactive-region))
>>         (if (member "deleted" (notmuch-search-get-tags))
>>             (notmuch-search-tag (list "-deleted") beg end)
>>           (notmuch-search-tag (list "+deleted") beg end))))
>>
>> It works really well for me :). "inbox" and other tags work similarly.
>>

Thread: