Further configure mail

This commit is contained in:
Case Duckworth 2022-02-21 22:40:35 -06:00
parent 147f94f5d2
commit 4326b4327f
3 changed files with 31 additions and 4 deletions

View File

@ -465,7 +465,7 @@
(setup notmuch
(:load-from "~/usr/share/emacs/site-lisp/")
;;(:load-after org-contacts)
(:also-load +notmuch)
(:also-load +notmuch +message)
(+define-dir notmuch/ (sync/ "emacs/notmuch")
"Notmuch configuration and data.")
(:option notmuch-init-file (notmuch/ "notmuch-init.el" t)
@ -473,7 +473,8 @@
notmuch-address-use-company (featurep 'company)
notmuch-search-oldest-first nil)
;; Composing mail
(:option message-kill-buffer-on-exit t)
(:option message-kill-buffer-on-exit t
message-auto-save-directory "~/var/mail/drafts")
;; Sending mail
(:option send-mail-function #'sendmail-send-it
mail-specify-envelope-from t
@ -482,7 +483,7 @@
;; Extras and fixes
(with-eval-after-load 'notmuch
(load notmuch-init-file :noerror)
;;(add-hook 'notmuch-show-mode-hook #'visual-fill-column-mode)
(add-hook 'message-setup-hook #'+message-signature-setup)
(add-hook 'message-send-hook #'+send-mail-dispatch)
(advice-add 'notmuch-tag :filter-args #'+notmuch-correct-tags)
(:option notmuch-saved-searches (list

26
lisp/+message.el Normal file
View File

@ -0,0 +1,26 @@
;;; +message.el --- Extra message-mode functions -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;; Thanks to Alex Schroeder for this!
;; https://www.emacswiki.org/emacs/Change_Signature_Dynamically
(defun +message-check-for-signature-change (&rest ignore)
"Check for a change in the To: or Cc: fields"
(when (and (message--in-tocc-p)
(not (buffer-narrowed-p)))
(save-excursion
(goto-char (point-max))
(let ((end (point)))
(when (re-search-backward message-signature-separator nil t)
(delete-region (1- (match-beginning 0)) end)))
(message-insert-signature))))
(defun +message-signature-setup ()
(make-local-variable 'after-change-functions)
(push '+message-check-for-signature-change after-change-functions))
(provide '+message)
;;; +message.el ends here

View File

@ -53,7 +53,7 @@
"Display a notmuch count in the tab-bar."
(when (featurep 'notmuch)
(let* ((counts (notmuch-hello-query-counts notmuch-saved-searches))
(next (cl-find "next" counts :key (lambda (l) (plist-get l :name)) :test 'equal))
(next (cl-find "inbox" counts :key (lambda (l) (plist-get l :name)) :test 'equal))
(next-count (plist-get next :count)))
(when (and next-count (> next-count 0))
`((notmuch-count menu-item