mercredi 2 mai 2018

notmuch mark as spam

Adds a keybinding that applies/removes tags to the currently viewed email or --when looking at search results-- the thread under point.
(defun mark-spam ()
  (interactive)
  (let ((tlist '("+spam" "-unread" "-inbox" "-new")))
    (if (eq major-mode 'notmuch-show-mode)
 (progn
   (let ((id (notmuch-show-get-message-id)))
     (notmuch-tag id tlist)
     (notmuch-show-next-thread)))
      (notmuch-search-tag tlist)
      (notmuch-search-next-thread))))

(define-key 'notmuch-search-mode-map (kbd "S") 'mark-spam)
(define-key 'notmuch-show-mode-map (kbd "S") 'mark-spam)