Re: Repeat last tagging
Hi, Thanks to David Bremner's patience, I've managed to produce the code needed to perform the repeat last tagging functionality I was hoping for. It is based on the following function (my very first elisp function): ``` (defun inwit/notmuch-tree-repeat-tag () "Repeat the last tagging operation" (interactive) (notmuch-tree-tag (split-string-and-unquote (car notmuch-read-tag-changes-history ``` I've then bound that function to `.`, which is convenient since I use Evil and that's the standard for "repeat the last operation": ``` (evil-define-key 'nil notmuch-tree-mode-map (kbd ".") 'inwit/notmuch-tree-repeat-tag) ``` Anyway, I share this here in case others might find it useful. And with the code I share my wonder about notmuch, emacs and floss in general. And my gratitude! :) On Wed Jul 14, 2021 at 10:41 AM CEST, inwit wrote: > Hi, > > While using notmuch in emacs (which I love, thank you so much!!) I was > wondering if there's a way to repeat the last tagging operation for a > different message or thread. > > My usecase is that, in tree-mode, sometimes I need to tag several emails > from different threads, and it would come very handy if, after the first > tag change, I could use a shortcut (I'd choose '.', as in vim/evil) > which would apply the same tag change to other emails. Does this make > sense? I know I could perform a search for all the emails that I need > to tag and tag them all at the same time, but the criteria to select > them is usually not obvious. Another option would be to be able to mark > emails, then tag them (I've seen the emacs-region thing, but it's not > the same). > > Thanks in advance. And cheers again for the good work! > > Regards, ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Repeat last tagging
On Wed Jul 14, 2021 at 6:49 PM CEST, Carl Worth wrote: > On Wed, Jul 14 2021, inwit wrote: > > My current alternative is of course hit 'CTRL+p' after '+', retrieving the > > last tags in the minibuffer's memory. I guess I'll survive with that. > > I was actually going to respond to your initial request with this > suggestion. > > This is a very idiomatic approach to emacs command input, (_many_ > existing commands keep their own history and can be accessed with > CTRL+P). > > It has the advantage of allowing you to access many previous tag > operations, and not only the most recent. It also allows you to preview > the operation you're about to perform (in case you forgot about some > interceding tag operation). > > Cheers, > > -Carl ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Repeat last tagging
On Wed Jul 14, 2021 at 11:25 AM CEST, Tomi Ollila wrote: > On Wed, Jul 14 2021, in...@sindominio.net wrote: > It does, what it would require is saving last-tag-change to a variable > and then bind function to a key... Put that way, it sounds pretty straightforward... > I personally am not too interested for such a binding (It could be > "dangerous" to do accidental undesired change (but I also could be > wrong and like such a feature >;D) My current alternative is of course hit 'CTRL+p' after '+', retrieving the last tags in the minibuffer's memory. I guess I'll survive with that. > for reference I have the following bindings added to my configuration > file > > (define-key notmuch-show-user-map "u" > (lambda () "mark message unread" (interactive) > (notmuch-show-tag-message "+unread"))) > > (define-key notmuch-show-user-map "i" > (lambda () "remove inbox tag" (interactive) > (notmuch-show-tag-message "-inbox"))) > > which means uu restores "unread" and ui removes "inbox". Sounds handy, I'll try it. > > storing last-tag-change may provide hard if there > is no central place to execute "notmuch tag" command in notmuch emacs > source code... You mean we would need to modify every call to "notmuch tag" in the code, in order to save last-tag-change in a variable which is accesible in every other scope? It's my first dive into the code, thanks for your patience. Regards, > > > Tomi > > > I know I could perform a search for all the emails that I need > > to tag and tag them all at the same time, but the criteria to select > > them is usually not obvious. Another option would be to be able to mark > > emails, then tag them (I've seen the emacs-region thing, but it's not > > the same). > > > > Thanks in advance. And cheers again for the good work! > > > > Regards, > > ___ > > notmuch mailing list -- notmuch@notmuchmail.org > > To unsubscribe send an email to notmuch-le...@notmuchmail.org ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: Repeat last tagging
On Wed, Jul 14 2021, in...@sindominio.net wrote: > Hi, > > While using notmuch in emacs (which I love, thank you so much!!) I was > wondering if there's a way to repeat the last tagging operation for a > different message or thread. > > My usecase is that, in tree-mode, sometimes I need to tag several emails > from different threads, and it would come very handy if, after the first > tag change, I could use a shortcut (I'd choose '.', as in vim/evil) > which would apply the same tag change to other emails. Does this make > sense? It does, what it would require is saving last-tag-change to a variable and then bind function to a key... I personally am not too interested for such a binding (It could be "dangerous" to do accidental undesired change (but I also could be wrong and like such a feature >;D) for reference I have the following bindings added to my configuration file (define-key notmuch-show-user-map "u" (lambda () "mark message unread" (interactive) (notmuch-show-tag-message "+unread"))) (define-key notmuch-show-user-map "i" (lambda () "remove inbox tag" (interactive) (notmuch-show-tag-message "-inbox"))) which means uu restores "unread" and ui removes "inbox". one can bind to notmuch-show-mode-map in order for just one keypress to do tag-change... storing last-tag-change may provide hard if there is no central place to execute "notmuch tag" command in notmuch emacs source code... Tomi > I know I could perform a search for all the emails that I need > to tag and tag them all at the same time, but the criteria to select > them is usually not obvious. Another option would be to be able to mark > emails, then tag them (I've seen the emacs-region thing, but it's not > the same). > > Thanks in advance. And cheers again for the good work! > > Regards, > ___ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-le...@notmuchmail.org ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Repeat last tagging
Hi, While using notmuch in emacs (which I love, thank you so much!!) I was wondering if there's a way to repeat the last tagging operation for a different message or thread. My usecase is that, in tree-mode, sometimes I need to tag several emails from different threads, and it would come very handy if, after the first tag change, I could use a shortcut (I'd choose '.', as in vim/evil) which would apply the same tag change to other emails. Does this make sense? I know I could perform a search for all the emails that I need to tag and tag them all at the same time, but the criteria to select them is usually not obvious. Another option would be to be able to mark emails, then tag them (I've seen the emacs-region thing, but it's not the same). Thanks in advance. And cheers again for the good work! Regards, ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org