This adds an option to the tag-jump defcustom to apply a post-tagging
function. One natural option is to go to the next thread/message.
---

This is a first attempt at this. The main change needed is to update
the docstrings.

The structure is a little weird (a list with a plist as an
element). However this has two advantage, it is backward compatible,
and it is possible to hide the more complicated options.

Best wishes

Mark




 emacs/notmuch-tag.el | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el
index 09d182d..a6506dc 100644
--- a/emacs/notmuch-tag.el
+++ b/emacs/notmuch-tag.el
@@ -42,7 +42,25 @@
                (key-sequence :tag "Key")
                (radio :tag "Tag operations" (repeat :tag "Tag list" (string 
:format "%v" :tag "change"))
                       (variable :tag "Tag variable"))
-               (string :tag "Name"))))
+               (string :tag "Name")
+               (choice :tag "Advanced Options"
+                       (const :tag "None" nil)
+                       (list :tag "Choose"
+                             (const :format "" :post-search)
+                             (choice :tag "Post tag in search view: "
+                                     (const :tag "None" ignore)
+                                     (const :tag "Next" 
notmuch-search-next-thread)
+                                     (function :tag "Custom function" :format 
"%v"))
+                             (const :format "" :post-tree)
+                             (choice :tag "Post tag in tree view: "
+                                     (const :tag "None" ignore)
+                                     (const :tag "Next" 
notmuch-tree-next-message)
+                                     (function :tag "Custom function" :format 
"%v"))
+                             (const :format "" :post-show)
+                             (choice :tag "Post tag in show view: "
+                                     (const :tag "None" ignore)
+                                     (const :tag "Next" 
notmuch-show-next-message)
+                                     (function :tag "Custom function" :format 
"%v")))))))
 
 (defcustom notmuch-tagging-keys
   `((,(kbd "a") notmuch-archive-tags "Archive")
@@ -530,9 +548,18 @@ and vice versa."
             (name-string (if name
                              (if reverse (concat "Reverse " name)
                                name)
-                           (mapconcat #'identity tag-change " "))))
+                           (mapconcat #'identity tag-change " ")))
+            (adv-opts (fourth binding))
+            (post-tag-function
+             (case major-mode
+                   (notmuch-search-mode (plist-get adv-opts :post-search))
+                   (notmuch-show-mode (plist-get adv-opts :post-show))
+                   (notmuch-tree-mode (plist-get adv-opts :post-tree)))))
        (push (list key name-string
-                    `(lambda () (,tag-function ',tag-change)))
+                   `(lambda () (,tag-function ',tag-change)
+                      ,(if post-tag-function
+                           `(,post-tag-function)
+                         '(ignore))))
              action-map)))
     (push (list notmuch-tag-jump-reverse-key
                (if reverse
-- 
2.1.4

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to