(require 'bbdb)
(require 'bbdb-pgp)
(load-file (expand-file-name ".gnus" (user-home-directory)))
(bbdb-initialize 'gnus 'message 'w3 'sendmail)
(bbdb-insinuate-gnus)
(bbdb-insinuate-message)
(bbdb-insinuate-sc)
(bbdb-insinuate-sendmail)
(bbdb-insinuate-w3)
(setq
bbdb/pgp-method 'mml-pgpmime
bbdb/pgp-default-action 'sign
bbdb/pgp-quiet t)
(defun sy-bbdb-gnus-auto-notes-hook (record)
"Runs `bbdb-auto-notes-hook' on the original article.
This is so a header doesn't have to be visible for BBDB to notice
any changes.
Kudos to Robert Fenk <fenk@users.sf.net> for this."
(save-excursion
(set-buffer (get-buffer gnus-article-buffer))
(set-buffer gnus-original-article-buffer)
(goto-char (point-min))
(bbdb-auto-notes-hook record)))
(autoload 'gnus-convert-face-to-png "gnus-fun")
(defun sy-bbdb-display-cx-face ()
"Search for face properties and display the faces.
This is from Alex Shroeder."
(let ((inhibit-read-only t) (all-records bbdb-records)
cface xface record start ext)
(while all-records
(setq record (caar all-records)
cface (bbdb-record-getprop record 'cface)
xface (bbdb-record-getprop record 'face)
start (marker-position (nth 2 (car all-records))))
(when (or cface xface)
(setq ext (extent-at start)))
(when cface
(set-extent-begin-glyph
ext
(make-glyph
(list (vector 'png :data (gnus-convert-face-to-png cface))))))
(when xface
(set-extent-end-glyph
ext
(make-glyph
(list (vector 'xface :data (concat "X-Face: " xface)
:foreground "black"
:background "white")))))
(setq all-records (cddr all-records)))))
(setq
bbdb-always-add-addresses t
bbdb-canonicalize-redundant-nets-p t
bbdb-canonicalize-net-hook
(lambda (addr)
(cond
((string-match
"\\`\\([^0-9]+\\)\\(-dated-[^@]+\\|-[0-9]+\\|\\+[^@]+\\.[^@]+\\)\\(@.*\\)\\'"
addr)
(concat (substring addr (match-beginning 1) (match-end 1))
(substring addr (match-beginning 3) (match-end 3))))
(t addr)))
bbdb-complete-name-allow-cycling t
bbdb-completion-display-record t
bbdb-completion-type 'primary-or-name
bbdb-default-area-code 7
bbdb-dial-local-prefix nil
bbdb-display-layout 'multi-line
bbdb-dwim-net-address-allow-redundancy t
bbdb-electric-p nil
bbdb-new-nets-always-primary 'never
bbdb-north-american-phone-numbers-p nil
bbdb-notice-hook 'sy-bbdb-gnus-auto-notes-hook
bbdb-offer-save 'auto
bbdb-pop-up-display-layout 'multi-line
bbdb-pop-up-target-lines 7
bbdb-quiet-about-name-mismatches nil
bbdb-use-pop-up nil
bbdb/gnus-score-default 25
bbdb/gnus-summary-in-bbdb-format-letter "X"
bbdb/mail-auto-create-p nil
bbdb/news-auto-create-p nil)
(let ((emails '("steve@steveyoungs.com"
"steve@thereadinglamp.net"
"steve@bastard.steveyoungs.com"
"steve@bastard.no-ip.org"
"steve@sxemacs.org"
"steve@sywriting.com"
"sryoungs@iinet.net.au"
"steve.r.youngs@gmail.com"
"post@gwene.org")))
(setq bbdb-user-mail-names (regexp-opt emails t)))
(setq bbdb-auto-notes-alist
'(("Organization"
(".*" company 0 'replace))
("Newsgroups"
("[^,]+" newsgroups 0))
("Subject"
(".*" last-subj 0 'replace))
("User-Agent"
(".*" mailer 0 'replace))
("X-Mailer"
(".*" mailer 0 'replace))
("X-Newsreader"
(".*" mailer 0 'replace))
("X-Attribution"
(".*" attribution 0 'replace))
("X-Now-Playing"
(".*" music 0 'replace))
("X-Face"
(".+" face 0 'replace))
("Face"
(".+" cface 0 'replace))))
(autoload 'bbdb-define-all-aliases "bbdb-com"
"Hook mail alias feature of BBDB into message-mode." t)
(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
(add-hook 'bbdb-change-hook 'bbdb-timestamp-hook)
(add-hook 'bbdb-create-hook 'bbdb-creation-date-hook)
(add-hook 'bbdb-list-hook 'sy-bbdb-display-cx-face)
(add-hook 'message-setup-hook 'bbdb-define-all-aliases)
(message "bbdb initialised")
Copyright © 2020 Steve Youngs
Verbatim copying and distribution is permitted in any medium,
providing this notice is preserved.
Last modified: Wed Apr 15 18:14:43 AEST 2020