diff options
-rw-r--r-- | config/doom/config.org | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/config/doom/config.org b/config/doom/config.org index c10375d..4a057db 100644 --- a/config/doom/config.org +++ b/config/doom/config.org @@ -226,6 +226,7 @@ this new window. ("d" . notmuch-show-delete-message) ("D" . notmuch-show-delete-thread-then-exit) ("i" . notmuch-show-tag-spam) + ("cb" . on/notmuch-spam-test) ("cr" . org-store-link) ) :config @@ -269,10 +270,28 @@ this new window. (interactive) (notmuch-show-tag-message (notmuch-toggle-tag "deleted" (notmuch-show-get-tags)))) + (defun on/bogofilter (&rest args) + "Call bogofilter on current notmuch-show-file with ARGS." + (let ((msg-file (notmuch-show-get-filename))) + (with-temp-buffer + (apply #'call-process "bogofilter" msg-file t nil args) + (message (string-trim (buffer-string)))))) + + (defun on/notmuch-spam-test () + "Evaluate spaminess of message." + (interactive) + (on/bogofilter "-v")) + + (defun on/bogofilter-set-spam (spam-p) + "Set spam or ham depending according to SPAM-P." + (on/bogofilter "-v" (if spam-p "-s" "-n"))) + (defun notmuch-show-tag-spam () "Tag spam on current message if already marked as spam undo." (interactive) - (notmuch-show-tag-message (notmuch-toggle-tag "spam" (notmuch-show-get-tags)))) + (let ((tag (notmuch-toggle-tag "spam" (notmuch-show-get-tags)))) + (notmuch-show-tag-message tag) + (on/bogofilter-set-spam (string-prefix-p "+" tag)))) (defun notmuch-show-delete-thread-then-exit () "Delete all messages in the current buffer, then exit back to search results." |