summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-11-10 21:33:14 +0000
committerjao <jao@gnu.org>2022-11-10 21:34:11 +0000
commit5300330a27ce64f43b0ed36a9fa0a49158d19c6a (patch)
tree7a39c7b3efe155bfc5263d993a3c1dd6a95867a7
parent1de3153eee916b18a069ad08519a067000e35c2e (diff)
downloadelibs-5300330a27ce64f43b0ed36a9fa0a49158d19c6a.tar.gz
elibs-5300330a27ce64f43b0ed36a9fa0a49158d19c6a.tar.bz2
email adjustments, and fcc in notmuch based on current folder
-rw-r--r--custom/jao-custom-email.el10
-rw-r--r--custom/jao-custom-gnus.el12
-rw-r--r--custom/jao-custom-notmuch.el4
-rw-r--r--init.el3
-rw-r--r--lib/net/jao-notmuch.el16
5 files changed, 32 insertions, 13 deletions
diff --git a/custom/jao-custom-email.el b/custom/jao-custom-email.el
index a315c25..46fdd12 100644
--- a/custom/jao-custom-email.el
+++ b/custom/jao-custom-email.el
@@ -1,10 +1,16 @@
;; -*- lexical-binding: t; -*-
+;;; main email system
+(require 'jao-afio)
+(setq jao-afio-mail-function 'gnus)
+(setq jao-afio-mail-function 'notmuch)
+
+(defvar jao-notmuch-enabled (eq jao-afio-mail-function 'notmuch))
+
;;; personal emails and others
(defvar jao-mails)
(defvar jao-extra-mails)
(defvar jao-mails-regexp (regexp-opt jao-mails))
-(defvar jao-notmuch-enabled (eq jao-afio-mail-function 'notmuch))
;;; gnus
(setq gnus-init-file "~/.emacs.d/gnus.el"
@@ -305,5 +311,7 @@
(jao-consult-add-buffer-source 'jao-mail-consult-source)
+(require 'jao-custom-notmuch)
+
;;; .
(provide 'jao-custom-email)
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index 2d074b5..f5f0c10 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -183,7 +183,7 @@
;;;; nnml
(setq mail-sources
- (when jao-gnus-use-nnml
+ (when (and jao-gnus-use-nnml (not jao-notmuch-enabled))
(let ((fix (regexp-opt '("feeds" "local" "trash" "spam"))))
(mapcar (lambda (d) `(maildir :path ,(concat d "/")))
(directory-files "~/var/mail/" t
@@ -733,10 +733,12 @@
(define-key gnus-summary-save-map "-" 'gnus/randomsig-summary-read-sig)))
;;;; recoll
-(with-eval-after-load "org"
- (org-link-set-parameters "message" :follow #'jao-gnus-goto-file))
-(with-eval-after-load "consult-recoll"
- (add-to-list 'consult-recoll-open-fns '("message/rfc822" . jao-gnus-goto-file)))
+(unless jao-notmuch-enabled
+ (with-eval-after-load "org"
+ (org-link-set-parameters "message" :follow #'jao-gnus-goto-file))
+ (with-eval-after-load "consult-recoll"
+ (add-to-list 'consult-recoll-open-fns
+ '("message/rfc822" . jao-gnus-goto-file))))
;;; Keyboard shortcuts
(define-key gnus-article-mode-map "i" 'jao-gnus-show-images)
(define-key gnus-summary-mode-map "i" 'jao-gnus-show-images)
diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el
index 492da2d..1135ec7 100644
--- a/custom/jao-custom-notmuch.el
+++ b/custom/jao-custom-notmuch.el
@@ -231,8 +231,8 @@
notmuch-draft-quoted-tags '("part")
notmuch-fcc-dirs
'(("\\(support\\|education\\)@bigml.com" . nil)
- (".*@bigml.com" . "bigml/trove -new -unread +sent +bigml +trove")
- (".*" . "trove/jao -new -unread +sent +jao +trove"))
+ (".*@bigml.com" . "bigml.inbox -new -unread +sent +bigml")
+ (".*" . "jao.inbox -new -unread +sent +jao"))
notmuch-maildir-use-notmuch-insert t)
:custom ((notmuch-address-internal-completion '(sent nil)))
diff --git a/init.el b/init.el
index d8b5e55..3a8f70e 100644
--- a/init.el
+++ b/init.el
@@ -1581,10 +1581,7 @@
;; (transient-get-suffix 'jao-transient-pdf-view '(0 -1))
;;; Email
-(setq jao-afio-mail-function 'gnus)
-
(require 'jao-custom-email)
-(require 'jao-custom-notmuch)
;;; Shells and terms
;;;; shell modes
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 48a8ff8..1e9eb4c 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -1,4 +1,4 @@
-;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*-
+;;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*-
;; Copyright (C) 2021, 2022 jao
@@ -328,6 +328,7 @@
(let ((tags (plist-get (notmuch-tree-get-message-properties) :orig-tags)))
(jao-notmuch-tree--tag tags nil)))
+;;; fcc
(defvar jao-notmuch-mua-reply-not-inherited
'("attachment" "sent" "new" "bigml" "jao" "trove"))
@@ -342,9 +343,20 @@
(fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs))))
(append fcc-dirs `((".*" . ,fcc)))))
+(defun jao-notmuch-mua--inherited-fcc ()
+ (let* ((fn (notmuch-show-get-filename))
+ (dest (and (string-match ".*/var/mail/\\(.+?\\)/.+" fn)
+ (match-string 1 fn)))
+ (tags (seq-difference (notmuch-show-get-tags)
+ '("attachment" "sent" "new" "flagged")))
+ (tagstr (mapconcat (lambda (s) (concat "+" s)) tags " "))
+ (fcc (concat dest " " tagstr " -new +sent +trove"))
+ (fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs))))
+ (append fcc-dirs `((".*" . ,fcc)))))
+
(defun jao-notmuch-mua-new-reply (fun &rest args)
(let ((notmuch-fcc-dirs (and (not (notmuch-show-get-header :List-Id))
- (jao-notmuch-mua--fcc-dirs))))
+ (jao-notmuch-mua--inherited-fcc))))
(apply fun args)))
(advice-add 'notmuch-mua-new-reply :around #'jao-notmuch-mua-new-reply)