>>>>> "Kai" == Kai Großjohann = <[EMAIL PROTECTED]>
>>>>> writes:
Kai> Until recently, we used JWZ's bbdb-pilot.el to transfer
Kai> addresses from BBDB to the Pilot. Now we have upgraded from
Kai> BBDB 2.00 to 2.32, and that file doesn't work anymore.
What was old is new again... :-)
If you download:
http://www.splode.com/users/friedman/software/emacs-lisp/src/bbdb-pilot-jwz.el
and then apply the attached patch (218 lines, sorry) it should work.
Other changes are:
* Fixed bug to make it concatenate street components properly. It
used to just use the last non-empty component.
* Also export entries with company but no name.
Note that I haven't tried this version against anything before the
BBDB version 6 file format (which is when I assume the streets thing
happened), but it should work just like before (due to a few conds)...
peace & happiness,
martin
*** bbdb-pilot-jwz.el 2001/04/19 09:21:01 1.5
--- bbdb-pilot-jwz.el 2001/04/19 10:21:27 1.7
***************
*** 5,11 ****
;; Maintainer: Noah Friedman <[EMAIL PROTECTED]>
;; Created: 2000-01-21
! ;; $Id: bbdb-pilot-jwz.el,v 1.5 2001/04/19 09:21:01 martins Exp $
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
--- 5,11 ----
;; Maintainer: Noah Friedman <[EMAIL PROTECTED]>
;; Created: 2000-01-21
! ;; $Id: bbdb-pilot-jwz.el,v 1.7 2001/04/19 10:21:27 martins Exp $
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
***************
*** 303,321 ****
(addr1 (pop addrs)))
(cond
(addr1
! (let ((st (bbdb-address-street1 addr1)))
! (if (> (length (bbdb-address-street2 addr1)) 0)
! (setq st (concat "\n" (bbdb-address-street2 addr1))))
! (if (> (length (bbdb-address-street3 addr1)) 0)
! (setq st (concat "\n" (bbdb-address-street3 addr1))))
!
! (setq st (concat (bbdb-address-location addr1) ":\n" st))
!
! (bbdb-pilot-set-address pilot st)
! (bbdb-pilot-set-city pilot (bbdb-address-city addr1))
! (bbdb-pilot-set-state pilot (bbdb-address-state addr1))
! (bbdb-pilot-set-zip pilot (bbdb-address-zip-string addr1))
! (bbdb-pilot-set-country pilot nil))))
(cond
(addrs
--- 303,328 ----
(addr1 (pop addrs)))
(cond
(addr1
! (let (st)
!
! (cond
! ((>= bbdb-file-format 6)
! (setq st (bbdb-join (bbdb-address-streets addr1) "\n")))
!
! (t
! (setq st (bbdb-address-street1 addr1))
! (if (> (length (bbdb-address-street2 addr1)) 0)
! (setq st (concat st "\n" (bbdb-address-street2 addr1))))
! (if (> (length (bbdb-address-street3 addr1)) 0)
! (setq st (concat st "\n" (bbdb-address-street3 addr1))))))
!
! (setq st (concat (bbdb-address-location addr1) ":\n" st))
!
! (bbdb-pilot-set-address pilot st)
! (bbdb-pilot-set-city pilot (bbdb-address-city addr1))
! (bbdb-pilot-set-state pilot (bbdb-address-state addr1))
! (bbdb-pilot-set-zip pilot (bbdb-address-zip-string addr1))
! (bbdb-pilot-set-country pilot nil))))
(cond
(addrs
***************
*** 328,339 ****
(set-buffer (get-buffer-create "*bbdb-tmp*"))
(erase-buffer)
(insert (bbdb-address-location addr) ":\n")
! (if (= 0 (length (setq s (bbdb-address-street1 addr)))) nil
! (indent-to 8) (insert s "\n"))
! (if (= 0 (length (setq s (bbdb-address-street2 addr)))) nil
! (indent-to 8) (insert s "\n"))
! (if (= 0 (length (setq s (bbdb-address-street3 addr)))) nil
! (indent-to 8) (insert s "\n"))
(indent-to 8)
(insert (setq c (bbdb-address-city addr)))
(setq s (bbdb-address-state addr))
--- 335,354 ----
(set-buffer (get-buffer-create "*bbdb-tmp*"))
(erase-buffer)
(insert (bbdb-address-location addr) ":\n")
! (cond
! ((>= bbdb-file-format 6)
! (let ((sts (bbdb-address-streets addr)))
! (while sts
! (indent-to 8)
! (insert (car sts) "\n")
! (setq sts (cdr sts)))))
! (t
! (if (= 0 (length (setq s (bbdb-address-street1 addr)))) nil
! (indent-to 8) (insert s "\n"))
! (if (= 0 (length (setq s (bbdb-address-street2 addr)))) nil
! (indent-to 8) (insert s "\n"))
! (if (= 0 (length (setq s (bbdb-address-street3 addr)))) nil
! (indent-to 8) (insert s "\n"))))
(indent-to 8)
(insert (setq c (bbdb-address-city addr)))
(setq s (bbdb-address-state addr))
***************
*** 449,455 ****
;;
(cond ((> (length (bbdb-pilot-address pilot)) 0)
(let ((addr (make-vector bbdb-address-length nil))
! loc st1 st2 st3
(street (bbdb-pilot-address pilot))
(cty (bbdb-pilot-city pilot))
(ste (bbdb-pilot-state pilot))
--- 464,470 ----
;;
(cond ((> (length (bbdb-pilot-address pilot)) 0)
(let ((addr (make-vector bbdb-address-length nil))
! loc sts st1 st2 st3
(street (bbdb-pilot-address pilot))
(cty (bbdb-pilot-city pilot))
(ste (bbdb-pilot-state pilot))
***************
*** 463,483 ****
(if (string-match "^\\([^ \t\n:]+\\):[ \t\n]*" street)
(setq loc (substring street 0 (match-end 1))
street (substring street (match-end 0))))
! (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
! (setq st1 (substring street 0 (match-end 1))
! street (substring street (match-end 0))))
! (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
! (setq st2 (substring street 0 (match-end 1))
! street (substring street (match-end 0))))
! (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
! (setq st3 (substring street 0 (match-end 1))
street (substring street (match-end 0))))
- (bbdb-address-set-location addr loc)
- (bbdb-address-set-street1 addr (or st1 ""))
- (bbdb-address-set-street2 addr (or st2 ""))
- (bbdb-address-set-street3 addr (or st3 ""))
(bbdb-address-set-city addr (or cty ""))
(bbdb-address-set-state addr (or ste ""))
(bbdb-address-set-zip addr zip)
--- 478,507 ----
(if (string-match "^\\([^ \t\n:]+\\):[ \t\n]*" street)
(setq loc (substring street 0 (match-end 1))
street (substring street (match-end 0))))
+ (bbdb-address-set-location addr loc)
! (cond
! ((>= bbdb-file-format 6)
! (while (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
! (setq sts (append
! sts
! (list (substring street 0 (match-end 1))))
street (substring street (match-end 0))))
+ (bbdb-address-set-streets addr sts))
+ (t
+ (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
+ (setq st1 (substring street 0 (match-end 1))
+ street (substring street (match-end 0))))
+ (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
+ (setq st2 (substring street 0 (match-end 1))
+ street (substring street (match-end 0))))
+ (if (string-match "^\\([^\n]+\\)\\(\n\\|$\\)" street)
+ (setq st3 (substring street 0 (match-end 1))
+ street (substring street (match-end 0))))
+ (bbdb-address-set-street1 addr (or st1 ""))
+ (bbdb-address-set-street2 addr (or st2 ""))
+ (bbdb-address-set-street3 addr (or st3 ""))))
(bbdb-address-set-city addr (or cty ""))
(bbdb-address-set-state addr (or ste ""))
(bbdb-address-set-zip addr zip)
***************
*** 527,546 ****
(defun bbdb-to-pilot ()
"Push the current contents of BBDB out to the Pilot."
! ; (interactive)
(bbdb-records) ; load bbdb
(message "Selecting records...")
(let ((records
(remove-if-not
#'(lambda (record)
! (and (bbdb-record-name record)
(let ((phones-p nil)
(phones (bbdb-record-phones record)))
(while phones
(let ((loc (bbdb-phone-location (car phones))))
(if (and (not (string-match "cid" loc))
(not (string-match "[?]" loc)))
! (setq phones-p t)))
(setq phones (cdr phones)))
phones-p)))
(bbdb-records)))
--- 551,571 ----
(defun bbdb-to-pilot ()
"Push the current contents of BBDB out to the Pilot."
! (interactive)
(bbdb-records) ; load bbdb
(message "Selecting records...")
(let ((records
(remove-if-not
#'(lambda (record)
! (and (or (bbdb-record-name record)
! (bbdb-record-company record))
(let ((phones-p nil)
(phones (bbdb-record-phones record)))
(while phones
(let ((loc (bbdb-phone-location (car phones))))
(if (and (not (string-match "cid" loc))
(not (string-match "[?]" loc)))
! (setq phones-p t)))
(setq phones (cdr phones)))
phones-p)))
(bbdb-records)))