0> In article <[EMAIL PROTECTED]>, 0> Mats Löfdahl <URL:mailto:[EMAIL PROTECTED]> ("Mats") wrote: Mats> So for Swedish addresses in a Swedish BBDB database it makes Mats> sense to store and display Swedish zip codes without the prefix. ^^^^^^^^^^^^^^^^^ I believe in the latter, but am firmly against the former. It would be nice to change my context and have, for example, phone numbers appear in the local format. For this, it helps for them to be stored in canonical format (with leading '+' for phone numbers). I do have some (incomplete) code I wrote about 5 years ago for canonicalising and localising phone numbers. I never got around to using it for display/entry of phone numbers in my BBDB, though - it's remained just a toy. For anyone who's interested, here's my code, with configuration for my office: (defvar bbdb-canon-to-local-phone-alist '(("+" . "00 ") ; international dialling ("0044" . "0") ; UK (replace +44 with 0) ("01223" . "") ; local call - no area code ("" . "9 ") ; dial 9 to get outside line ("95689" . "89") ; 3 different blocks on company switchboard ("95080" . "80") ("97131" . "31")) "*How to transform canonical telephone numbers to local form") (defvar bbdb-phone-local-to-canon-alist '(("89" . "9 5689") ; company switchboard (3 blocks) ("80" . "9 5080") ("31" . "9 7131") ("900" . "+") ("90" . "+44 ") ("9" . "+44 1223 ")) "*How to transform local telephone numbers to canonical form") (defun bbdb-localise-phone (number) (interactive "sLocalise phone number: \n") (save-excursion (let ((alist bbdb-canon-to-local-phone-alist) (buffer (set-buffer (generate-new-buffer " *BBDB canonicalise phone*"))) new-number) (unwind-protect (progn (insert number) (goto-char (point-min)) (while alist (let ((s1 (car (car alist))) (s2 (cdr (car alist))) (num number)) (setq alist (cdr alist)) (goto-char (point-min)) (while (and s1 (not (string= s1 ""))) (skip-chars-forward "^0-9+") (if (= (char-after (point)) (elt s1 0)) (setq s1 (substring s1 1 )) (setq s1 nil)) (forward-char)) (if s1 (progn (skip-chars-forward "^0-9+") (delete-region (point-min) (point)) (insert s2))))) (setq new-number (buffer-string))) (kill-buffer buffer)) (and (interactive-p) new-number (message "To reach %s, dial %s" number new-number)) new-number))) _______________________________________________ [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/bbdb-info BBDB Home Page: http://bbdb.sourceforge.net/
