diff --git a/ReadMe.org b/ReadMe.org index 6f2f948..b1a1295 100644 --- a/ReadMe.org +++ b/ReadMe.org @@ -1144,84 +1144,213 @@ I use ~notmuch~ to index and search through my large mail inboxes. #+begin_src emacs-lisp :tangle "init.el" - (use-package notmuch - :ensure t - :init - - (setq notmuch-search-oldest-first nil) - (setq notmuch-show-logo nil + (use-package notmuch + :ensure t + :init + (setq notmuch-search-oldest-first nil) + (setq notmuch-show-logo nil notmuch-column-control 1.0 notmuch-hello-auto-refresh t notmuch-hello-recent-searches-max 20 notmuch-hello-thousands-separator "" notmuch-hello-sections '(notmuch-hello-insert-saved-searches) notmuch-show-all-tags-list t) - (setq notmuch-show-empty-saved-searches t) - (setq notmuch-saved-searches - `(( :name "telecom/inbox" - :query "tag:inbox and tag:telecom and folder:telecom/INBOX" - :sort-order newest-first - :key ,(kbd "i")) - ( :name "telecom/CGT" - :query "tag:telecom and tag:inbox and tag:cgt" - :sort-order newest-first - :key ,(kbd "u")) - ( :name "telecom/all" - :query "tag:telecom and tag:inbox" - :sort-order newest-first - :key ,(kbd "o")) - ( :name "work/inbox" - :query "tag:work and folder:work/INBOX" - :sort-order newest-first - :key ,(kbd "p")) - ( :name "work/RB" - :query "tag:work and tag:inbox and tag:reproducible-builds" - :sort-order newest-first - :key ,(kbd "c")) + (setq notmuch-show-empty-saved-searches t) + (setq notmuch-saved-searches + `(( :name "telecom/inbox" + :query "tag:inbox and tag:telecom and folder:telecom/INBOX" + :sort-order newest-first + :key ,(kbd "t i")) + ( :name "telecom/CGT" + :query "tag:telecom and tag:inbox and tag:cgt" + :sort-order newest-first + :key ,(kbd "t c")) + ( :name "telecom/all" + :query "tag:telecom and tag:inbox" + :sort-order newest-first + :key ,(kbd "t a")) + ( :name "work/inbox" + :query "tag:work and tag:inbox and folder:work/INBOX" + :sort-order newest-first + :key ,(kbd "w i")) + ( :name "work/RB" + :query "tag:work and tag:inbox and tag:reproducible-builds" + :sort-order newest-first + :key ,(kbd "w r")) ( :name "work/bluehats" :query "tag:work and tag:inbox and tag:bluehats" :sort-order newest-first - :key ,(kbd "p")) + :key ,(kbd "w b")) ( :name "work/all" :query "tag:work and tag:inbox" :sort-order newest-first - :key ,(kbd "p")))) + :key ,(kbd "w a")) + ( :name "ens/inbox" + :query "tag:inbox and tag:ens" + :sort-order newest-first + :key ,(kbd "e i")) + ( :name "dgnum/inbox" + :query "tag:inbox and tag:dgnum and folder:dgnum/INBOX" + :sort-order newest-first + :key ,(kbd "d i")) + ( :name "dgnum/bureau" + :query "tag:inbox and tag:dgnum and tag:bureau" + :sort-order newest-first + :key ,(kbd "d b")) + ( :name "dgnum/federez" + :query "tag:inbox and tag:dgnum and tag:federez" + :sort-order newest-first + :key ,(kbd "d f")) + ( :name "dgnum/nixcon" + :query "tag:inbox and tag:dgnum and tag:nixcon" + :sort-order newest-first + :key ,(kbd "d n")) + ( :name "dgnum/fai" + :query "tag:inbox and tag:dgnum and tag:fai" + :sort-order newest-first + :key ,(kbd "d f")) + ( :name "dgnum/all" + :query "tag:inbox and tag:dgnum" + :sort-order newest-first + :key ,(kbd "d a")) + )) - (setq notmuch-search-result-format - '(("date" . "%12s ") - ("count" . "%-7s ") - ("authors" . "%-20s ") - ("subject" . "%-80s ") - ("tags" . "(%s)"))) - - (setq notmuch-tree-result-format - '(("date" . "%12s ") - ("authors" . "%-20s ") - ((("tree" . "%s") - ("subject" . "%s")) - . " %-80s ") - ("tags" . "(%s)"))) + (setq notmuch-archive-tags '("+archive" "-inbox" "-unread" "-junk") + notmuch-message-replied-tags '("+replied") + notmuch-message-deleted-tags '("+trash" "-inbox" "-unread" "-junk") + notmuch-message-forwarded-tags '("+forwarded") + notmuch-show-mark-read-tags '("-unread") + notmuch-draft-tags '("+draft") + notmuch-draft-folder "drafts" + notmuch-draft-save-plaintext 'ask) - (setq notmuch-search-oldest-first nil) - (add-to-list 'meow-mode-state-list '(notmuch-hello-mode . motion)) - (add-to-list 'meow-mode-state-list '(notmuch-search-mode . motion)) - (add-to-list 'meow-mode-state-list '(notmuch-tree-mode . motion)) - (add-to-list 'meow-mode-state-list '(notmuch-show-mode . motion)) + (setq notmuch-search-result-format + '(("date" . "%12s ") + ("count" . "%-7s ") + ("authors" . "%-20s ") + ("subject" . "%-80s ") + ("tags" . "(%s)"))) + + (setq notmuch-tree-result-format + '(("date" . "%12s ") + ("authors" . "%-20s ") + ((("tree" . "%s") + ("subject" . "%s")) + . " %-80s ") + ("tags" . "(%s)"))) - (setq mail-specify-envelope-from t) - (setq message-sendmail-envelope-from 'header) - (setq mail-envelope-from 'header)) + (setq notmuch-search-oldest-first nil) + (add-to-list 'meow-mode-state-list '(notmuch-hello-mode . motion)) + (add-to-list 'meow-mode-state-list '(notmuch-search-mode . motion)) + (add-to-list 'meow-mode-state-list '(notmuch-tree-mode . motion)) + (add-to-list 'meow-mode-state-list '(notmuch-show-mode . motion)) + + (setq mail-specify-envelope-from t) + (setq message-sendmail-envelope-from 'header) + (setq mail-envelope-from 'header)) + +#+end_src + +** Composition + +#+begin_src emacs-lisp :tangle "init.el" + (use-package notmuch + :ensure nil + :after notmuch + :defer t + :config + (setq notmuch-mua-compose-in 'current-window) + (setq notmuch-mua-hidden-headers nil) + (setq notmuch-always-prompt-for-sender t) + (setq notmuch-mua-cite-function 'message-cite-original-without-signature) + (setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never) + (setq notmuch-mua-user-agent-function nil) + (setq notmuch-maildir-use-notmuch-insert t) + (setq notmuch-crypto-process-mime t) + (setq notmuch-crypto-get-keys-asynchronously t) + (setq notmuch-mua-attachment-regexp ; see `notmuch-mua-send-hook' + (concat "\\b\\(attache\?ment\\|attached\\|attach\\|" + "pi[èe]ce\s+jointe?\\|" + "συνημμ[εέ]νο\\|επισυν[αά]πτω\\)\\b"))) +#+end_src + +** Reading messages + +#+begin_src emacs-lisp :tangle "init.el" + (use-package notmuch + :ensure nil + :after notmuch + :defer t + :config + (setq notmuch-show-relative-dates t) + (setq notmuch-show-all-multipart/alternative-parts nil) + (setq notmuch-show-indent-messages-width 0) + (setq notmuch-show-indent-multipart nil) + (setq notmuch-show-part-button-default-action 'notmuch-show-view-part) + (setq notmuch-wash-wrap-lines-length 120) + (setq notmuch-unthreaded-show-out nil) + (setq notmuch-message-headers '("To" "Cc" "Subject" "Date")) + (setq notmuch-message-headers-visible t)) +#+end_src + + +** Bindings + +#+begin_src emacs-lisp :tangle "init.el" + (use-package notmuch + :ensure nil + :after notmuch + :demand t + :hook + (notmuch-mua-send . notmuch-mua-attachment-check) + :config + (defun notmuch-tag-then-archive () + "First prompt for tags to add via notmuch-search-tag, then archive the thread." + (interactive) + (call-interactively 'notmuch-search-tag) + (notmuch-search-archive-thread)) + + (defun notmuch-search-message-delete () + (interactive) + "Delete message and select next message." + (notmuch-search-tag notmuch-message-deleted-tags) + (notmuch-search-next-thread)) + + (remove-hook 'notmuch-show-hook #'notmuch-show-turn-on-visual-line-mode) + (remove-hook 'notmuch-search-hook #'notmuch-hl-line-mode) ; Check my `lin' package + :bind + ( :map global-map + ("C-c m" . notmuch-jump-search) + ("C-x m" . notmuch-mua-new-mail) + :map notmuch-search-mode-map + ("A" . notmuch-tag-then-archive) + ("a" . notmuch-search-archive-thread) + ("D" . notmuch-search-message-delete) + ("/" . notmuch-search-filter) ; alias for l + ("r" . notmuch-search-reply-to-thread) ; easier to reply to all by default + ("R" . notmuch-search-reply-to-thread-sender) + :map notmuch-show-mode-map + ("a" . nil) + ("A" . nil) + ("r" . notmuch-show-reply) + ("R" . notmuch-show-reply-sender) + :map notmuch-hello-mode-map + ("C-" . nil))) +#+end_src + + + + +#+begin_src emacs-lisp :tangle "init.el" (use-package notmuch-addr :ensure t) (with-eval-after-load 'notmuch-address (notmuch-addr-setup)) - (setq sendmail-program "msmtp" send-mail-function 'smtpmail-send-it - message-sendmail-f-is-evil t message-sendmail-envelope-from 'header message-send-mail-function 'message-send-mail-with-sendmail) @@ -1301,7 +1430,33 @@ I want the number of unread messages in my ~notmuch-hello~ buffer. (advice-add 'notmuch-hello-insert-buttons :override #'luj/notmuch-hello-insert-buttons) #+end_src - +Let's add an indicator in the modeline, as well: + +#+begin_src emacs-lisp :tangle "init.el" + (use-package notmuch-indicator + :ensure t + :after notmuch + :config + (setq notmuch-indicator-args + '(( :terms "tag:unread and tag:inbox and tag:telecom and folder:telecom/INBOX" + :label "🔍 ") + ( :terms "tag:unread and tag:inbox and tag:work and folder:work/INBOX" + :label "🚧 ") + ( :terms "tag:unread and tag:inbox and tag:ens" + :label "🎓 ") + ( :terms "tag:unread and tag:inbox and tag:dgnum and folder:dgnum/INBOX" + :label "💾 ")) + + notmuch-indicator-refresh-count 60 + notmuch-indicator-hide-empty-counters t + notmuch-indicator-notmuch-config-file "/home/julien/.config/notmuch/default/config" + notmuch-indicator-force-refresh-commands '(notmuch-refresh-this-buffer)) + + (notmuch-indicator-mode 1)) + +#+end_src + + * Programming @@ -1513,6 +1668,10 @@ I don't like how I must open another buffer to get documentation, so let's go wi :after eglot :hook (python-mode . eglot-ensure)) + + (org-babel-do-load-languages + 'org-babel-load-languages + '((python . t))) #+end_src @@ -1642,6 +1801,7 @@ Well, why not use it for PDF? Also integrate with /LaTeX/ etc. :ensure (:host github :repo "havarddj/typst-preview.el")) #+end_src + *** Lisp #+begin_src emacs-lisp :tangle "init.el"