only show unread messages in notmuch-show threads (fold read msgs)

This commit is contained in:
Max Nickel 2019-10-23 22:58:51 -04:00
parent 07d219a300
commit 5324cb2fc8
2 changed files with 22 additions and 0 deletions

View file

@ -92,6 +92,25 @@
(start-process-shell-command "email" nil (format "xdg-open '%s'" temp)))) (start-process-shell-command "email" nil (format "xdg-open '%s'" temp))))
;;;###autoload
(defun +notmuch/show-filter-thread ()
"Show the current thread with a different filter"
(interactive)
(setq notmuch-show-query-context (notmuch-read-query "Filter thread: "))
(notmuch-show-refresh-view t))
;;;###autoload
(defun +notmuch-expand-only-unread-h ()
(interactive)
(let ((unread nil)
(open (notmuch-show-get-message-ids-for-open-messages)))
(notmuch-show-mapc (lambda ()
(when (member "unread" (notmuch-show-get-tags))
(setq unread t))))
(when unread
(let ((notmuch-show-hook (remove '+notmuch/expand-only-unread-hook notmuch-show-hook)))
(notmuch-show-filter-thread "tag:unread")))))
;; ;;
;; Advice ;; Advice

View file

@ -42,6 +42,9 @@
;; (setq-hook! 'notmuch-show-mode-hook line-spacing 0) ;; (setq-hook! 'notmuch-show-mode-hook line-spacing 0)
;; only unfold unread messages in thread by default
(add-hook 'notmuch-show-hook '+notmuch-expand-only-unread-h)
(add-hook 'doom-real-buffer-functions #'notmuch-interesting-buffer) (add-hook 'doom-real-buffer-functions #'notmuch-interesting-buffer)
(advice-add #'notmuch-start-notmuch-sentinel :around #'+notmuch-dont-confirm-on-kill-process-a) (advice-add #'notmuch-start-notmuch-sentinel :around #'+notmuch-dont-confirm-on-kill-process-a)