>>>>> "DG" == David S Goldberg <[EMAIL PROTECTED]> writes:

DG> A look through the manuals indicates that zip codes are either an
DG> integer if "american", which I presumably have set, or a list of
DG> strings if "non-american" which I apparently want to have set
DG> (much as I set bbdb-north-american-phone-numbers-p to nil).  But I
DG> can't find any variable or whatever to specify the non-american
DG> zip codes.  How do I do this?

>> There isn't one.  The way the zip is stored depends on what BBDB
>> (and hence SyncBBDB) sees in the contents of the zip.  If it is a
>> string of digits it becomes a single number (and any leading zero's
>> are dropped).

DG> Bummer.  But after some thought, I guess I really don't care too
DG> much about the internal representation since I'm not a developer.
DG> What's really bugging me is that the display doesn't zeropad a US
DG> zip of <5 digits (and bbdb *knows* it's a US zip because it chose
DG> the integer internal format).  I'll try to come up with a patch.
DG> I'm hoping I just have to add a %05 to a format statement
DG> somewhere.

    Well I can tell you where to add the %05 (bbdb.el line: 868):

      ;; else a number, could be 3 to 5 digits (possible error: assuming
      ;; no leading zeroes in zip codes)
!      (format "%5d" (bbdb-address-zip addr)))))

    I never bothered to try and submit it as a patch since the comment
makes it pretty clear that some other country also stores it's zip as
a single number but has a different number of digits than US zips...

    So your assertion that BBDB *knows* it's a US zip is false it just
knows that it's a fully numeric zip consisting of a single number.

    This is a bit better, but I think we really need a much more
general framework for this stuff. I've already had to add some similar
hacks (in bbdb-address-formatting-alist) to avoid using continental
format for zip+4 stored as two strings :(.

---

(defvar bbdb-default-country "USA"
        "Default country to be used when formatting addresses 
that lack a country field")

---

  (let ((country (downcase (or (bbdb-address-country addr)
                                 bbdb-default-country))))
    (if (or (string-equal country "us")
            (string-equal country "usa"))
          (format "%5d" (bbdb-address-zip addr))
     (format "%d" (bbdb-address-zip addr))))

---
Hope this helps anyway...

-- 
                                                        Thomas DeWeese
[EMAIL PROTECTED]
                          "The only difference between theory and practice is
                           that in theory there isn't any." -- unknown
_______________________________________________
bbdb-info mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/bbdb-info

Reply via email to