summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-07-07 17:18:44 -0700
committerFranck Cuny <franck@fcuny.net>2022-07-07 17:39:49 -0700
commit0568939440cb1e0f84f3386d7619dc467c8f3f56 (patch)
tree9909365be37c4f0e34691650337ca2386f7beb58
parentref(elfeed): remove more feeds (diff)
downloademacs.d-0568939440cb1e0f84f3386d7619dc467c8f3f56.tar.gz
feat(notmuch): tweak a bit more the configuration
Add a few more things to the default configuration:
- set the MUA with the version of Emacs/notmuch
- cache the addresses
- define the tags used to archive emails
- set the fcc dir
- add a number of saved searches
- format the search result

Change-Id: Iec21e76e7ac4fce0d299e367b2c59bf8bbbe9718
Reviewed-on: https://cl.fcuny.net/c/emacs.d/+/613
Tested-by: CI
Reviewed-by: Franck Cuny <franck@fcuny.net>
-rw-r--r--emacs/custom/my-notmuch.el70
1 files changed, 57 insertions, 13 deletions
diff --git a/emacs/custom/my-notmuch.el b/emacs/custom/my-notmuch.el
index 69fadd9..b150619 100644
--- a/emacs/custom/my-notmuch.el
+++ b/emacs/custom/my-notmuch.el
@@ -6,27 +6,71 @@
 
 (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"))
+(setq notmuch-archive-tags '("-inbox" "-unread" "-new" "+archive"))
+(setq notmuch-fcc-dirs '(("franck@fcuny.net" . "\"FastMail/Sent\" +sent +fastmail -inbox")))
 
 ;; configurations related to search
-(setq notmuch-search-oldest-first nil
-      ;; a few saved search - I can jump to them by hitting 'j'
-      notmuch-saved-searches '((:name "unread":query "tag:unread AND date:this_year.." :key "u")
-                               (:name "inbox unread" :query "tag:inbox AND tag:unread" :key "U")
-                               (:name "today" :query "date:today" :key "t")
-                               (:name "this week" :query "date:this_week.." :key "w")
+;; (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")
-                               (:name "all emails" :query "*" :key "a"))
-      ;; make it short and sweet
-      notmuch-search-result-format '(("date" . "%12s ")
-                                     ("authors" . "%-20s ")
-                                     ("tags" . "(%s) ")
-                                     ("subject" . "%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)