diff --git a/site-modules/core/files/emacs/init.el b/site-modules/core/files/emacs/init.el index e9578bd..46fbe96 100644 --- a/site-modules/core/files/emacs/init.el +++ b/site-modules/core/files/emacs/init.el @@ -101,6 +101,7 @@ ;; Email "e" '(:ignore t :which-key "Email") "ei" 'aa/notmuch-search-inbox + "eu" 'aa/notmuch-search-inbox-unread "es" 'counsel-notmuch "en" 'notmuch "ej" 'notmuch-jump-search diff --git a/site-modules/core/files/emacs/src/notmuch.el b/site-modules/core/files/emacs/src/notmuch.el index d4b831a..34da5a9 100644 --- a/site-modules/core/files/emacs/src/notmuch.el +++ b/site-modules/core/files/emacs/src/notmuch.el @@ -6,6 +6,8 @@ ;; licence that can be found in the LICENCE file or at ;; https://www.practically.io/copyright/ +(require 'cl) + (defvar notmuch-message-deleted-tags '("+deleted" "-inbox" "-unread")) (defun spacemacs/notmuch-search-archive-thread-down () @@ -42,14 +44,26 @@ (interactive) (notmuch-search "tag:inbox")) -(use-package notmuch - :defer t - :commands notmuch - :config +(defun aa/notmuch-search-inbox-unread () + "Search the notmuch unread messages in the inbox." + (interactive) + (notmuch-search "tag:inbox and tag:unread")) + + +(quelpa + '(notmuch :fetcher git + :url "https://git.notmuchmail.org/git/notmuch" + :commit "a59ef7d02cb229c2ec3569024918024003568aea" + :files ("emacs/*.el" "emacs/*.png")) + (setq notmuch-saved-searches '((:name "inbox" :key "i" :query "tag:inbox" :sort-order newest-first) + (:name "inbox-unread" + :key "iu" + :query "tag:inbox and tag:unread" + :sort-order newest-first) (:name "unread" :key "u" :query "tag:unread" @@ -80,3 +94,29 @@ "d" 'spacemacs/notmuch-message-delete-down)) (use-package counsel-notmuch :defer t) + +(defun org-notmuch-open (id) + "Visit the notmuch message or thread with id ID." + (notmuch-show id)) + +(defun org-notmuch-store-link () + "Store a link to a notmuch mail message." + (cl-case major-mode + ('notmuch-show-mode + ;; Store link to the current message + (let* ((id (notmuch-show-get-message-id)) + (link (concat "notmuch:" id)) + (description (format "Mail: %s" (notmuch-show-get-subject)))) + (org-store-link-props + :type "notmuch" + :link link + :description description))) + ('notmuch-search-mode + ;; Store link to the thread on the current line + (let* ((id (notmuch-search-find-thread-id)) + (link (concat "notmuch:" id)) + (description (format "Mail: %s" (notmuch-search-find-subject)))) + (org-store-link-props + :type "notmuch" + :link link + :description description)))))