From 251c8c4d50e52405f33cfbb5a3f509376052038b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 24 Jun 2023 11:50:19 +1000 Subject: Make bbdb gnus integration usable --- emacs/.emacs.d/init/ycp-gnus.el | 7 +++++-- emacs/.emacs.d/lisp/my/my-bbdb.el | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/init/ycp-gnus.el b/emacs/.emacs.d/init/ycp-gnus.el index bf8ffae..6eef1cd 100644 --- a/emacs/.emacs.d/init/ycp-gnus.el +++ b/emacs/.emacs.d/init/ycp-gnus.el @@ -183,10 +183,13 @@ (my-package bbdb (:delay 5) (bbdb-initialize 'gnus 'message) - ;; Too noisy - ;; (bbdb-mua-auto-update-init 'gnus 'message) + (bbdb-mua-auto-update-init 'gnus 'message) + (setq bbdb-message-all-addresses t) + (setq bbdb-mua-pop-up-window-size .15) (setq bbdb-mail-user-agent 'gnus-user-agent) (setq bbdb-update-records-p 'create) + (setq bbdb-message-clean-mail-function 'my-bbdb-clean-mail) + (setq bbdb-add-name nil) (require 'my-bbdb) (my-keybind bbdb-mode-map "C-c C-c" #'my-bbdb-done) (setq bbdb-phone-style nil diff --git a/emacs/.emacs.d/lisp/my/my-bbdb.el b/emacs/.emacs.d/lisp/my/my-bbdb.el index 80661cd..f5aa420 100644 --- a/emacs/.emacs.d/lisp/my/my-bbdb.el +++ b/emacs/.emacs.d/lisp/my/my-bbdb.el @@ -186,5 +186,12 @@ If NAME exists in bbdb, update. Otherwise insert." (interactive) (bbdb "")) +(defun my-bbdb-clean-mail (address) + "Cleans email address." + (setq address (bbdb-string-trim address)) + (cond ((string-match "\\`\\([^@+]+\\)\\+[^@]+\\(@.*\\)\\'" address) + (concat (match-string 1 address) (match-string 2 address))) + (t address))) + (provide 'my-bbdb) ;;; my-bbdb.el ends here -- cgit v1.2.3