Re: [PATCH] emacs: add global tag history
On Fri Jan 6, 2023 at 12:36 PM CET, David Bremner wrote: > Although this patch won't apply anymore, thanks for inspiring the work that > lead to supporting undo. Unfortunately I stole the name > "notmuch-tag-history" for a buffer local variable, so I guess someone > interested in a global history would need to choose a different variable > name. Thanks to you, David! Undo is great. I'd like to make another attempt at global tag history and repeating last tagging operation. I hope to find the time soon! ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
inwit writes: > Save a list of every tag change in the new variable notmuch-tag-history. > --- > Storing the full history of tags can prove useful for a) repeated tag > changes as in [0] and b) eventually logging and undoing tag changes. > > This is my first commit in elisp. I expect turbulences ahead. :) > > [0] > https://nmbug.notmuchmail.org/nmweb/show/CCSQ9HR3M748.2IRNNTHYR4A2M%40bisio > > emacs/notmuch-tag.el | 4 > 1 file changed, 4 insertions(+) Although this patch won't apply anymore, thanks for inspiring the work that lead to supporting undo. Unfortunately I stole the name "notmuch-tag-history" for a buffer local variable, so I guess someone interested in a global history would need to choose a different variable name. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
inwit writes: > On 2022-01-26 16:40, David Bremner wrote: >> I guess for undo you will need to save the query as well? >> >> Even that will not be perfect (since the messages matching the query >> could change behind emacs back), but close enough for most interactive >> use, maybe? > > I was thinking about saving the IDs of the messages affected by the > change, but I still don't know how would I go about that or if it's > sensible. Absent some new feature in notmuch tag, you'd need to do another query to get the set of message-ids. That set would still be subject to change between that query and tagging operation, so that is a bit unsatisfactory. Also the set of message-ids could be impractically large. ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
On Wed Jan 26, 2022 at 6:43 PM CET, Jose Antonio Ortega Ruiz wrote: > maybe this could be a buffer-local history variable, for notmuch search > and tree search buffers, and the undo feature apply only to the current > search buffer. the view update is then well-defined, i think, if it's > just changing tags, at least, and per-buffer operation is the normal > behaviour of undo/redo in emacs. hooking that up with the regular emacs > undo/redo mechanism would be great (in my book at least), but i've never > looked at that, so not sure if it's possible. This sounds very much like it, yes. Would this need automatic update of the buffer? If a message is deleted, for instance, an undo operation should bring it back to the buffer, right? Of course, this sort of modification is still far in my slow learner horizon... > > cheers, > jao > -- > Keep away from people who try to belittle your ambitions. Small people > always do that, but the really great make you feel that you, too, can > become great. - Mark Twain > ___ > 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: [PATCH] emacs: add global tag history
David Bremner writes: > One thing that has changed since those early days is that we now have > lastmod (see notmuch-search-terms(7)): queries, but that is still not > atomic. I guess it might not be too hard to have notmuch tag output > output the correct lastmod value. Then we could store that as shorthand > for a set of messages. Now that I think about it, that wouldn't really be robost either, since something that was changed after that tagging operation would get a new lastmod value. But maybe we could define that as a feature. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
Carl Worth writes: > On Wed, Jan 26 2022, inwit wrote: >>> Even that will not be perfect (since the messages matching the query >>> could change behind emacs back), but close enough for most interactive >>> use, maybe? >> >> I was thinking about saving the IDs of the messages affected by the >> change, but I still don't know how would I go about that or if it's >> sensible. > > One could imagine a history that would enable a conventional undo stack > for a notmuch interface. The trick with making that usable would be the > need to refresh views to make what was undone evident, (and the fact > that some of the operations could be large/slow). > > All of those issues kept me from pursuing the idea in early days of > coding up the emacs notmuch UI. But someone could certainly explore the > implementation further if desired. One thing that has changed since those early days is that we now have lastmod (see notmuch-search-terms(7)): queries, but that is still not atomic. I guess it might not be too hard to have notmuch tag output output the correct lastmod value. Then we could store that as shorthand for a set of messages. d ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
On Wed, Jan 26 2022, inwit wrote: >> Even that will not be perfect (since the messages matching the query >> could change behind emacs back), but close enough for most interactive >> use, maybe? > > I was thinking about saving the IDs of the messages affected by the > change, but I still don't know how would I go about that or if it's > sensible. One could imagine a history that would enable a conventional undo stack for a notmuch interface. The trick with making that usable would be the need to refresh views to make what was undone evident, (and the fact that some of the operations could be large/slow). All of those issues kept me from pursuing the idea in early days of coding up the emacs notmuch UI. But someone could certainly explore the implementation further if desired. -Carl ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
On 2022-01-26 16:40, David Bremner wrote: I guess for undo you will need to save the query as well? Even that will not be perfect (since the messages matching the query could change behind emacs back), but close enough for most interactive use, maybe? I was thinking about saving the IDs of the messages affected by the change, but I still don't know how would I go about that or if it's sensible. Thanks! ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
Re: [PATCH] emacs: add global tag history
inwit writes: > Save a list of every tag change in the new variable notmuch-tag-history. > --- > Storing the full history of tags can prove useful for a) repeated tag > changes as in [0] and b) eventually logging and undoing tag changes. I guess for undo you will need to save the query as well? Even that will not be perfect (since the messages matching the query could change behind emacs back), but close enough for most interactive use, maybe? ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org
[PATCH] emacs: add global tag history
Save a list of every tag change in the new variable notmuch-tag-history. --- Storing the full history of tags can prove useful for a) repeated tag changes as in [0] and b) eventually logging and undoing tag changes. This is my first commit in elisp. I expect turbulences ahead. :) [0] https://nmbug.notmuchmail.org/nmweb/show/CCSQ9HR3M748.2IRNNTHYR4A2M%40bisio emacs/notmuch-tag.el | 4 1 file changed, 4 insertions(+) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 8af09e68..68341cf2 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -388,6 +388,9 @@ the messages that were tagged." (defvar notmuch-read-tag-changes-history nil "Minibuffer history of `notmuch-read-tag-changes' function.") +(defvar notmuch-tag-history nil + "Global history of `notmuch-tag' function.") + (defun notmuch-tag-completions ( search-terms) "Return a list of tags for messages matching SEARCH-TERMS. @@ -478,6 +481,7 @@ notmuch-after-tag-hook will be run." (unless query (error "Nothing to tag!")) (when tag-changes +(push tag-changes notmuch-tag-history) (notmuch-dlet ((tag-changes tag-changes) (query query)) (run-hooks 'notmuch-before-tag-hook)) -- 2.32.0 ___ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org