There are times when I'd like the bbdb completion to NOT use the primary
email address.  Below is a suggested patch that prompts for the address, if
bbdb-select-primary-net is set to 'nil'.

Based on version 2.00.06

*** bbdb.el     2000/10/19 23:43:54     1.1
--- bbdb.el     2000/10/19 23:44:56
***************
*** 346 ****
--- 347,353 ----
+ (defcustom bbdb-select-primary-net t
+   "Controls the behaviour of selecting the net address.  If t, always select
+   the primary net.  If nil, prompt for the net address, if necessary"
+   :group 'bbdb-record-use
+   :type '(choice (const :tag "Always select the primary net" t)
+                (const :tag "Prompt the user, if necessary" nil)))
+ 

*** bbdb-com.el 2000/10/19 23:45:26     1.1
--- bbdb-com.el 2000/10/20 00:14:56
***************
*** 1395 ****
--- 1396,1416 ----
+ (defun bbdb-get-selected-net-address (record)
+   "If more than one net address, prompt the user.  However, if
+ 'bbdb-select-primary-net' is set to t, the always select the primary 
+ address"
+   (interactive)
+   (let ((nets (bbdb-record-net record)))
+     (cond
+      ((or bbdb-select-primary-net (= 1 (length nets)))
+       (car nets))
+      (t
+       (let ((table (mapcar 'list nets)); '(lambda (a) (cons a a)) nets)))
+           (default (car nets)))
+       (bbdb-pop-up-bbdb-buffer)
+       (bbdb-display-records (list record))
+       (let ((res (completing-read
+                   (format "select net [%s]: " default)
+                   table 'identity 'required nil nil default)))
+         (delete-window (get-buffer-window bbdb-buffer-name))
+         res
+         ))))))
+ 
***************
*** 1397 ****
! (defun bbdb-dwim-net-address (record &optional net)
--- 1418 ----
! (defun bbdb-dwim-net-address (record &optional net select)
***************
*** 1404 ****
!   (or net (setq net (car (bbdb-record-net record))))
--- 1425,1428 ----
!   (or net
!       (setq net
!           (or (and (not select) (car (bbdb-record-net record)))
!               (bbdb-get-selected-net-address record))))
***************
*** 1450 ****
- 
--- 1473 ----
***************
*** 1772 ****
!                          the-one))))
--- 1795,1796 ----
!                          the-one))
!                      t))

_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/bbdb-info

Reply via email to