[EMAIL PROTECTED] writes:
 > Please post your patch.

Here it is, it contains something more than the patch for the hook
itself, but iirc, relavitely minor changes otherwise.

I can clean it up if you wish.

? autom4te.cache
? testing/Makefile
? texinfo/dir
Index: lisp/bbdb-com.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-com.el,v
retrieving revision 1.170
diff -u -r1.170 bbdb-com.el
--- lisp/bbdb-com.el    22 Mar 2004 15:18:33 -0000      1.170
+++ lisp/bbdb-com.el    17 Oct 2004 23:07:13 -0000
@@ -1858,7 +1858,7 @@
                  (const :tag "Allow redundancy" t)))
 
 ;;;###autoload
-(defun bbdb-dwim-net-address (record &optional net)
+(defun bbdb-dwim-net-address (record &optional net skip-backslash)
   "Returns a string to use as the email address of the given record.  The
 given address is the address the mail is destined to; this is formatted like
 \"Firstname Lastname <addr>\" unless both the first name and last name are
@@ -1881,10 +1881,11 @@
       (setq fn (bbdb-record-firstname record)
             ln (bbdb-record-lastname record)))
     ;; if the name contains backslashes or double-quotes, backslash them.
-    (if name
-        (while (setq i (string-match "[\\\"]" name i))
-          (setq name (concat (substring name 0 i) "\\" (substring name i))
-                i (+ i 2))))
+    (unless skip-backslash
+      (if name
+         (while (setq i (string-match "[\\\"]" name i))
+           (setq name (concat (substring name 0 i) "\\" (substring name i))
+                 i (+ i 2)))))
     (cond ((eq 'netonly bbdb-dwim-net-address-allow-redundancy)
            net)
           ((or (null name)
@@ -2267,6 +2268,12 @@
   :group 'bbdb-mua-specific
   :type 'boolean)
 
+(defcustom bbdb-complete-net-hook nil
+  "List of functions called after a successful completion with `net'
+as argument."
+  :group 'bbdb-mua-specific
+  :type 'boolean)
+
 (defcustom bbdb-complete-name-hooks nil
   "List of functions called after a sucessful completion."
   :group 'bbdb-mua-specific
@@ -2381,7 +2388,9 @@
                     ;; replace with new mail address
                     (delete-region beg end)
                     (insert (bbdb-dwim-net-address rec this-addr))
+                   (run-hook-with-args 'bbdb-complete-net-hook this-addr)
                     (run-hooks 'bbdb-complete-name-hooks)
+
                     (throw 'bbdb-cycling-exit t))))))
 
           ;; FALL THROUGH
@@ -2469,6 +2478,12 @@
                       (forward-char 1)
                       (insert "\n   "))))))
 
+       (run-hook-with-args 'bbdb-complete-net-hook
+                           (let ((net (bbdb-record-net (car match-recs))))
+                             (if (listp net)
+                                 (car net)
+                               net)))
+
         ;; Update the *BBDB* buffer if desired.
         (if bbdb-completion-display-record
             (let ((bbdb-gag-messages t))
Johann

Reply via email to