;;; my-notmuch.el --- Configures notmuch -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (require 'notmuch) (setq mail-envelope-from 'header) (setq mail-specify-envelope-from t) (setq message-sendmail-envelope-from 'header) (setq mail-host-address (system-name)) (setq notmuch-mua-user-agent-function (lambda () (format "Emacs %s; notmuch.el %s" emacs-version notmuch-emacs-version))) (setq notmuch-mua-cite-function #'message-cite-original-without-signature) (defvar my/notmuch-cache-dir (format "%s/.cache/notmuch" (getenv "HOME"))) (make-directory my/notmuch-cache-dir t) ;; Cache addresses for completion: (setq notmuch-address-save-filename (concat my/notmuch-cache-dir "/addresses")) ;; kill the buffer after sending the message (setq message-kill-buffer-on-exit t) (setq message-send-mail-function 'message-send-mail-with-sendmail) (setq send-mail-function 'sendmail-send-it) (setq notmuch-show-logo nil) (setq notmuch-always-prompt-for-sender t) (setq notmuch-show-relative-dates t) (setq notmuch-archive-tags '("-inbox" "-unread" "-new" "+archive")) (setq notmuch-fcc-dirs '(("franck@fcuny.net" . "\"FastMail/Sent\" +sent +fastmail -inbox"))) ;; configurations related to search ;; (TODO: this is not working !?) (setq notmuch-search-oldest-first nil) ;; a few saved search - I can jump to them by hitting 'j' (setq notmuch-saved-searches '(;; all unread messages in my inbox (:name "inbox unread" :query "tag:inbox AND tag:unread" :key "U" :sort-order "newest-first") ;; all messages in my inbox (:name "inbox" :query "tag:inbox" :key "i") ;; all messages for the current day (:name "today" :query "date:today" :key "t" :sort-order "newest-first") ;; all messages for the current week (:name "this week" :query "date:this_week.." :key "w") ;; all messages in the inbox that are ;; unread and less than a week old (:name "focused inbox" :query "tag:inbox AND tag:unread AND date:this_week.." :key "f") ;; all messages that are flagged (:name "flagged" :query "tag:flagged" :key "F") ;; all messages that have a calendar ;; invitation, that are unread and in ;; my inbox (:name "pending calendar invites" :query "tag:unread AND tag:inbox AND attachment:ics" :key "c") ;; all unread messages for a year (:name "unread":query "tag:unread AND date:this_year.." :key "u") ;; all messages I've sent (:name "sent" :query "tag:sent" :key "s") ;; all my emails, no filter (:name "all emails" :query "*" :key "a"))) (setq notmuch-show-empty-saved-searches t) ;; make it short and sweet (setq notmuch-search-result-format '(("date" . "%12s ") ("count" . "%-7s ") ("authors" . "%-30s ") ("subject" . "%-72s ") ("tags" . "(%s)"))) (add-hook 'notmuch-message-mode-hook 'flyspell-mode) (provide 'my-notmuch) ;;; my-notmuch.el ends here