1 ;; 08-bbdb-sy.el --- Big Brother DataBase (BBDB) -*- Emacs-Lisp -*-
3 ;; Copyright (C) 2007 - 2012 Steve Youngs
5 ;; Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;; Created: <2007-12-02>
8 ;; Time-stamp: <Sunday Jun 10, 2012 10:57:19 steve>
9 ;; Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
10 ;; HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/08-bbdb-sy.html>
11 ;; Git Repo: git clone http://git.sxemacs.org/syinit
12 ;; Keywords: init, compile
14 ;; This file is part of SYinit
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;; notice, this list of conditions and the following disclaimer.
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;; notice, this list of conditions and the following disclaimer in the
25 ;; documentation and/or other materials provided with the distribution.
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;; may be used to endorse or promote products derived from this
29 ;; software without specific prior written permission.
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 ;; The HTML version of this file was created with Hrvoje Niksic's
51 ;; htmlize.el which is part of the XEmacs "text-modes" package.
59 ;:*=======================
60 ;:* Make sure gnus stuff is loaded
61 (load-file (expand-file-name ".gnus" (user-home-directory)))
63 ;:*======================
64 ;:* Some standard stuff first
68 (bbdb-initialize 'gnus 'message 'w3 'sendmail)
70 (bbdb-insinuate-message)
72 (bbdb-insinuate-sendmail)
77 bbdb/pgp-method 'mml-pgpmime
78 bbdb/pgp-default-action 'sign
81 (defun sy-bbdb-gnus-auto-notes-hook (record)
82 "Runs `bbdb-auto-notes-hook' on the original article.
83 This is so a header doesn't have to be visible for BBDB to notice
85 Kudos to Robert Fenk <fenk@users.sf.net> for this."
87 (set-buffer (get-buffer gnus-article-buffer))
88 (set-buffer gnus-original-article-buffer)
89 (goto-char (point-min))
90 (bbdb-auto-notes-hook record)))
92 (autoload 'gnus-convert-face-to-png "gnus-fun")
94 (defun sy-bbdb-display-cx-face ()
95 "Search for face properties and display the faces.
96 This is from Alex Shroeder."
97 (let ((inhibit-read-only t); edit the BBDB buffer
98 (all-records bbdb-records)
99 cface xface record start)
101 (setq record (caar all-records)
102 cface (bbdb-record-getprop record 'cface)
103 xface (bbdb-record-getprop record 'face)
104 start (marker-position (nth 2 (car all-records))))
106 (set-extent-begin-glyph
107 (make-extent start start)
109 (list (vector 'png :data (gnus-convert-face-to-png cface)))))
112 (set-extent-begin-glyph
113 (make-extent start start)
115 (list (vector 'xface :data (concat "X-Face: " xface)
117 :background "white"))))
119 (setq all-records (cddr all-records)))))
122 bbdb-always-add-addresses t
123 bbdb-canonicalize-redundant-nets-p t
124 bbdb-canonicalize-net-hook
128 "\\`\\([^0-9]+\\)\\(-dated-[^@]+\\|-[0-9]+\\|\\+[^@]+\\.[^@]+\\)\\(@.*\\)\\'"
130 (concat (substring addr (match-beginning 1) (match-end 1))
131 (substring addr (match-beginning 3) (match-end 3))))
133 bbdb-complete-name-allow-cycling t
134 bbdb-completion-display-record t
135 bbdb-completion-type 'primary-or-name
136 bbdb-default-area-code 7
137 bbdb-dial-local-prefix nil
138 bbdb-display-layout 'multi-line
139 bbdb-dwim-net-address-allow-redundancy t
141 bbdb-new-nets-always-primary 'never
142 bbdb-north-american-phone-numbers-p nil
143 bbdb-notice-hook 'sy-bbdb-gnus-auto-notes-hook
144 bbdb-offer-save 'auto
145 bbdb-pop-up-display-layout 'multi-line
146 bbdb-pop-up-target-lines 7
147 bbdb-quiet-about-name-mismatches nil
149 bbdb/gnus-score-default 25
150 bbdb/gnus-summary-in-bbdb-format-letter "X"
151 bbdb/mail-auto-create-p nil
152 bbdb/news-auto-create-p nil)
154 ;:*=======================
155 ;:* All my email addresses, well the important ones anyway.
156 (let ((emails '("steve@steveyoungs.com"
157 "steve@thereadinglamp.net"
158 "steve@bastard.steveyoungs.com"
161 "sryoungs@iinet.net.au"
162 "jackalx@gmail.com")))
163 (setq bbdb-user-mail-names (regexp-opt emails t)))
165 ;:*=======================
166 ;:* Update some stuff automatically
167 (setq bbdb-auto-notes-alist
169 (".*" company 0 'replace))
171 ("[^,]+" newsgroups 0))
173 (".*" last-subj 0 'replace))
175 (".*" mailer 0 'replace))
177 (".*" mailer 0 'replace))
179 (".*" mailer 0 'replace))
181 (".*" attribution 0 'replace))
183 (".*" music 0 'replace))
185 (".+" face 0 'replace))
187 (".+" cface 0 'replace))))
189 ;:*=======================
191 (autoload 'bbdb-define-all-aliases "bbdb-com"
192 "Hook mail alias feature of BBDB into message-mode." t)
194 ;:*=======================
196 (add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
197 (add-hook 'bbdb-change-hook 'bbdb-timestamp-hook)
198 (add-hook 'bbdb-create-hook 'bbdb-creation-date-hook)
199 (add-hook 'bbdb-list-hook 'sy-bbdb-display-cx-face)
200 (add-hook 'message-setup-hook 'bbdb-define-all-aliases)
201 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*
202 (message "bbdb initialised")