From 79696dae3f99bac5f2a8fe59628fb02f5246bd66 Mon Sep 17 00:00:00 2001
From: jao <jao@gnu.org>
Date: Thu, 25 Aug 2022 05:40:40 +0100
Subject: email: better bcc computation

---
 custom/jao-custom-email.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/custom/jao-custom-email.el b/custom/jao-custom-email.el
index 3148c6c..8465790 100644
--- a/custom/jao-custom-email.el
+++ b/custom/jao-custom-email.el
@@ -58,12 +58,15 @@
 (setq message-expand-name-standard-ui t)
 
 ;;;; adjust bcc
-(defvar jao-message--bcc-rx (regexp-opt '("mail.io" "gnu.org")))
+(defvar jao-message--bcc-alist
+  `((,(regexp-quote "mail@jao.io") . "proton@jao.io")
+    (,(regexp-quote "jao@gnu.org") . "hacking@jao.io")))
 
 (defun jao-message-insert-bcc ()
   (let ((f (or (message-fetch-field "From") "")))
-    (when (or (string-blank-p f) (string-match-p jao-message--bcc-rx f))
-      (insert "Bcc: proton@jao.io\n"))))
+    (when-let (b (seq-some (lambda (x) (when (string-match-p (car x) f) (cdr x)))
+                           jao-message--bcc-alist))
+      (insert "Bcc: " b "\n"))))
 
 (add-hook 'message-header-setup-hook #'jao-message-insert-bcc)
 
@@ -216,8 +219,8 @@
 (jao-sendmail-local)
 
 ;;; bbdb
+(jao-load-path "bbdb/lisp")
 (use-package bbdb
-  :ensure t
   :init (setq bbdb-complete-name-allow-cycling t
               bbdb-completion-display-record nil
               bbdb-gui t
@@ -259,7 +262,7 @@
 
   (setq bbdb-file (expand-file-name "~/.emacs.d/bbdb"))
   (if jao-notmuch-enabled
-      (bbdb-initialize 'message)
+      (bbdb-initialize 'message 'notmuch)
     (bbdb-initialize 'message 'pgp 'gnus)))
 ;;; narrowing
 (defvar jao-mail-consult-buffer-history nil)
-- 
cgit v1.2.3