diff options
-rw-r--r-- | .emacs.d/init.el | 53 | ||||
-rwxr-xr-x | .fmail/.notmuch/hooks/post-new | 5 |
2 files changed, 35 insertions, 23 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 375dfe88..fc360a93 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -1196,7 +1196,7 @@ Two ways to read: (setq notmuch-tagging-keys '(("u" ("+unread") "Mark as unread") ("s" ("-unread" "+spam") "Mark as spam") - ("m" ("-unread" "+killed") "Kill thread") ; 'm' for 'mute' + ("m" ("-unread" "+spw::killed") "Kill thread") ; 'm' for 'mute' ("d" ("-unread" "+deleted") "Send to trash") ("f" ("-unread" "+flagged") "Unread->flagged") ("F" ("-flagged") "Unflag message"))) @@ -1272,19 +1272,21 @@ Two ways to read: (funcall ,function)) (add-hook ,hook ',sym ,append ,local)))) - (defun spw--notmuch-next-command-kills--remove () - (setq notmuch-archive-tags '("-unread"))) - (defun spw--notmuch-next-command-kills--add () - (setq notmuch-archive-tags '("-unread" "+killed")) - (add-hook-run-once - 'post-command-hook - 'spw--notmuch-next-command-kills--remove)) - (defun spw--notmuch-next-command-kills () - (interactive) - (message "Next archive command will also kill") - (add-hook-run-once - 'pre-command-hook - 'spw--notmuch-next-command-kills--add)) + ;; commented out as we want to avoid tagging whole threads with + ;; spw::killed to avoid committing more to ~/lib/nmbug-spw than is needed + ;; (defun spw--notmuch-next-command-kills--remove () + ;; (setq notmuch-archive-tags '("-unread"))) + ;; (defun spw--notmuch-next-command-kills--add () + ;; (setq notmuch-archive-tags '("-unread" "+killed")) + ;; (add-hook-run-once + ;; 'post-command-hook + ;; 'spw--notmuch-next-command-kills--remove)) + ;; (defun spw--notmuch-next-command-kills () + ;; (interactive) + ;; (message "Next archive command will also kill") + ;; (add-hook-run-once + ;; 'pre-command-hook + ;; 'spw--notmuch-next-command-kills--add)) (defun spw--notmuch-next-command-unread--remove () (setq notmuch-archive-tags '("-unread"))) @@ -1323,12 +1325,20 @@ Two ways to read: ;; (lambda () ;; (setq notmuch-archive-tags old))))) + ;; not available in `notmuch-search-mode' for now because we want to + ;; apply spw::killed to only a single message, not a whole thread, + ;; to minimise what gets committed to ~/lib/nmbug-spw (defun spw--kill-thread () (interactive) - (setq notmuch-archive-tags '("-unread" "+killed")) - (notmuch-show-archive-thread-then-next) - (setq notmuch-archive-tags '("-unread")) - (message "thread killed (on this machine only)")) + (case major-mode + (notmuch-show-mode + (notmuch-show-tag '("+spw::killed")) + (notmuch-show-archive-thread-then-next)) + (notmuch-tree-mode + (notmuch-tree-tag '("+spw::killed")) + (notmuch-tree-archive-thread) + (notmuch-tree-next-matching-message))) + (message "thread killed")) (defun spw--spam-thread () (interactive) @@ -1343,9 +1353,9 @@ Two ways to read: (bind-key "g" (notmuch-tree-close-message-pane-and #'notmuch-show-reply) notmuch-tree-mode-map) (bind-key "C-c |" 'spw--notmuch-import-gpg notmuch-show-mode-map) - (bind-key "K" 'spw--notmuch-next-command-kills notmuch-tree-mode-map) - (bind-key "K" 'spw--notmuch-next-command-kills notmuch-search-mode-map) - (bind-key "K" 'spw--notmuch-next-command-kills notmuch-show-mode-map) + ;; (bind-key "K" 'spw--notmuch-next-command-kills notmuch-tree-mode-map) + ;; (bind-key "K" 'spw--notmuch-next-command-kills notmuch-search-mode-map) + ;; (bind-key "K" 'spw--notmuch-next-command-kills notmuch-show-mode-map) (bind-key "U" 'spw--notmuch-next-command-unread notmuch-tree-mode-map) (bind-key "U" 'spw--notmuch-next-command-unread notmuch-search-mode-map) @@ -1388,6 +1398,7 @@ Two ways to read: (notmuch-refresh-this-buffer))) (bind-key "C" 'spw--notmuch-tree-catchup notmuch-tree-mode-map) + (bind-key "<f7>" 'spw--kill-thread notmuch-tree-mode-map) (bind-key "<f9>" 'spw--next-unread-group notmuch-tree-mode-map)) (use-package notmuch-hello diff --git a/.fmail/.notmuch/hooks/post-new b/.fmail/.notmuch/hooks/post-new index 6d34a18c..63e817b2 100755 --- a/.fmail/.notmuch/hooks/post-new +++ b/.fmail/.notmuch/hooks/post-new @@ -17,8 +17,9 @@ notmuch tag +spam -- folder:spam # mark all trash as trash notmuch tag +deleted -- folder:trash -# propagate the 'killed' tag to all messages in the killed message's thread -killed_threads=$(notmuch search --output=threads tag:killed) +# mark messages as read in threads I've killed. don't propagate the +# spw::killed tag itself +killed_threads=$(notmuch search --output=threads -- tag:spw::killed and tag:unread) if [ ! -z "$killed_threads" ]; then notmuch tag -unread -- $killed_threads fi |