Rudy’s OBTF Rudolf Adamkovič

Home / Emacs / Notmuch Search


My tagging

Replace the universal tagging interface with simple unread and spam tagging.

To toggle back, use Notmuch Show or notmuch-undo (C-/).

(with-eval-after-load 'notmuch

  (defun my-notmuch-search-tag-read (&optional extra-tag)
    "Mark thread or region as read."
    (interactive)
    (let ((region (notmuch-interactive-region)))
      ;; Remove the unread tag and add the extra tag if specified.
      (notmuch-search-tag (cons "-unread"
                                (if extra-tag
                                    (cons (concat "+" extra-tag) nil))))
      ;; If not operating on a region, advance to the next thread.
      (when (equal (nth 0 region)
                   (nth 1 region))
        (notmuch-search-next-thread))))

  (defun my-notmuch-search-tag-spam ()
    "Mark thread as read and spam."
    (interactive)
    (my-notmuch-search-tag-read "spam"))

  (keymap-set notmuch-search-mode-map "k" #'my-notmuch-search-tag-read)
  (keymap-set notmuch-search-mode-map "K" #'my-notmuch-search-tag-spam))

© 2025 Rudolf Adamkovič under GNU General Public License (GPL) version 3 or later.
Made with Emacs and secret alien technologies of yesteryear.