diff options
author | jao <jao@gnu.org> | 2022-03-11 23:00:30 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-03-12 23:59:11 +0000 |
commit | 3cfbfaa4817d16d03e4d7447960c50c42d206295 (patch) | |
tree | 89d5de36a8f3938c62ff50366fe04f698613614b /lib/net | |
parent | fa3900273567019d41424cef83d2899622fe3dcc (diff) | |
download | elibs-3cfbfaa4817d16d03e4d7447960c50c42d206295.tar.gz elibs-3cfbfaa4817d16d03e4d7447960c50c42d206295.tar.bz2 |
gnus notmuch tags: toggle on delete, append on move
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/jao-notmuch-gnus.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/net/jao-notmuch-gnus.el b/lib/net/jao-notmuch-gnus.el index b505ced..b6fafcd 100644 --- a/lib/net/jao-notmuch-gnus.el +++ b/lib/net/jao-notmuch-gnus.el @@ -87,11 +87,14 @@ (when (string-match ".+:\\(.+\\)" group) (split-string (match-string 1 group) "\\."))) -(defun jao-notmuch-gnus-tag-on-move (_operation headers from to _d) +(defun jao-notmuch-gnus-tag-on-move (op headers from to _d) (when-let* ((to-tags (when to (jao-notmuch-gnus--group-tags to))) (id (jao-notmuch-gnus--notmuch-id (mail-header-id headers)))) - (let ((from-tags (seq-difference (jao-notmuch-gnus--group-tags from) to-tags))) - (jao-notmuch-gnus-toggle-tags (append from-tags to-tags) id from-tags)))) + (if (eq op 'delete) + (let ((cur (seq-difference (jao-notmuch-gnus--group-tags from) to-tags))) + (jao-notmuch-gnus-toggle-tags (append cur to-tags) id cur)) + (notmuch-tag (concat "id:" id) + (mapcar (lambda (x) (concat "+" x)) to-tags))))) (add-hook 'gnus-summary-article-move-hook #'jao-notmuch-gnus-tag-on-move) (add-hook 'gnus-summary-article-expire-hook #'jao-notmuch-gnus-tag-on-move) |