[PATCH] emacs: add global tag history

Subject: [PATCH] emacs: add global tag history

Date: Wed, 26 Jan 2022 16:32:14 +0100

To: notmuch@notmuchmail.org

Cc: inwit

From: inwit

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


 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 (&rest 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))

notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org