unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Repeat last tagging
@ 2021-07-14  8:41 inwit
  2021-07-14  9:25 ` Tomi Ollila
  2022-01-20 16:36 ` inwit
  0 siblings, 2 replies; 5+ messages in thread
From: inwit @ 2021-07-14  8:41 UTC (permalink / raw)
  To: notmuch

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,

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

* Re: Repeat last tagging
  2021-07-14  8:41 Repeat last tagging inwit
@ 2021-07-14  9:25 ` Tomi Ollila
  2021-07-14 13:01   ` inwit
  2022-01-20 16:36 ` inwit
  1 sibling, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2021-07-14  9:25 UTC (permalink / raw)
  To: inwit, notmuch

On Wed, Jul 14 2021, inwit@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-leave@notmuchmail.org

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

* Re: Repeat last tagging
  2021-07-14  9:25 ` Tomi Ollila
@ 2021-07-14 13:01   ` inwit
       [not found]     ` <87sg0gvo1r.fsf@wobbit.home.cworth.org>
  0 siblings, 1 reply; 5+ messages in thread
From: inwit @ 2021-07-14 13:01 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

On Wed Jul 14, 2021 at 11:25 AM CEST, Tomi Ollila wrote:
> On Wed, Jul 14 2021, inwit@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-leave@notmuchmail.org

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

* Re: Repeat last tagging
       [not found]     ` <87sg0gvo1r.fsf@wobbit.home.cworth.org>
@ 2021-07-15  8:08       ` inwit
  0 siblings, 0 replies; 5+ messages in thread
From: inwit @ 2021-07-15  8:08 UTC (permalink / raw)
  To: Carl Worth, Tomi Ollila, notmuch

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

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

* Re: Repeat last tagging
  2021-07-14  8:41 Repeat last tagging inwit
  2021-07-14  9:25 ` Tomi Ollila
@ 2022-01-20 16:36 ` inwit
  1 sibling, 0 replies; 5+ messages in thread
From: inwit @ 2022-01-20 16:36 UTC (permalink / raw)
  To: notmuch

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,

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

end of thread, other threads:[~2022-01-20 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14  8:41 Repeat last tagging inwit
2021-07-14  9:25 ` Tomi Ollila
2021-07-14 13:01   ` inwit
     [not found]     ` <87sg0gvo1r.fsf@wobbit.home.cworth.org>
2021-07-15  8:08       ` inwit
2022-01-20 16:36 ` inwit

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