Sometimes I get a message from a mailing list with a From address like
this:
"John Doe via RT <[EMAIL PROTECTED]>"
Since I have a record for <[EMAIL PROTECTED]>, BBDB will
offer me to make "John Doe via" the name of this record, which is
certainly not what I want.
I added a variable `bbdb-canonicalize-name-hook', similar to
`bbdb-canonicalize-net-hook', and I set it like this:
(setq bbdb-canonicalize-name-hook
(lambda (name)
(when name
(cond ((string-match " via$" name) nil)
(name)))))
is there a better solution?
--
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Marriage is the sole cause of divorce.
cd d:/gnu/sitelisp/bbdb/lisp/
diff -u -b -w -i -B "d:/gnu/sitelisp/bbdb/lisp/bbdb.el.old"
"d:/gnu/sitelisp/bbdb/lisp/bbdb.el"
--- d:/gnu/sitelisp/bbdb/lisp/bbdb.el.old 2002-01-15 17:00:58.000000000 -0500
+++ d:/gnu/sitelisp/bbdb/lisp/bbdb.el 2003-07-23 10:23:29.000000000 -0400
@@ -642,6 +642,12 @@
:group 'bbdb-hooks
:type 'function)
+(defcustom bbdb-canonicalize-name-hook nil
+ "*If this is non-nil, it should be a function of one arg: the name string.
+See `bbdb-canonicalize-net-hook' for details."
+ :group 'bbdb-hooks
+ :type 'function)
+
(defcustom bbdb-canonicalize-redundant-nets-p t
"*If this is non-nil, redundant network addresses will be ignored.
If a record has an address of the form [EMAIL PROTECTED], setting this to t
@@ -2993,11 +2999,11 @@
match))))
-(defun bbdb-canonicalize-address (net)
- ;; call the bbdb-canonicalize-net-hook repeatedly until it returns a
+(defun bbdb-canonicalize (net hook)
+ ;; call the hook repeatedly until it returns a
;; value eq to the value passed in. This implies that it can't
;; destructively modify the string.
- (while (not (eq net (setq net (funcall bbdb-canonicalize-net-hook net)))))
+ (while (not (eq net (setq net (funcall hook net)))))
net)
@@ -3047,7 +3053,9 @@
(if (equal net "") (error "mail-extr returned \"\" as net")))
(if (and net bbdb-canonicalize-net-hook)
- (setq net (bbdb-canonicalize-address net)))
+ (setq net (bbdb-canonicalize net bbdb-canonicalize-net-hook)))
+ (if (and name bbdb-canonicalize-name-hook)
+ (setq name (bbdb-canonicalize name bbdb-canonicalize-name-hook)))
(let ((change-p nil)
(record (or (bbdb-search-simple nil net)
Diff finished at Wed Jul 23 10:23:35
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/