I propose the following documentation for the zip code related stuff
in BBDB, and the transformation of some defvars into defcustom.

Alex.


/home/alex/elisp/bbdb $ cvs diff -u
cvs server: Diffing .
Index: ChangeLog
===================================================================
RCS file: /cvsroot/bbdb/bbdb/ChangeLog,v
retrieving revision 2.68
diff -u -r2.68 ChangeLog
--- ChangeLog   2001/02/05 11:39:06     2.68
+++ ChangeLog   2001/02/06 20:12:52
@@ -1,3 +1,16 @@
+2001-02-06  Alex Schroeder  <[EMAIL PROTECTED]>
+
+       * texinfo/bbdb.texinfo (Customization Parameters): Documented
+       bbdb-check-zip-codes-p, bbdb-address-formatting-alist, and
+       bbdb-continental-zip-regexp.
+
+       * lisp/bbdb.el (bbdb-address-formatting-alist): defcustom.
+
+       * lisp/bbdb-com.el (bbdb-expand-mail-aliases): defcustom.
+       (bbdb-check-zip-codes-p): defcustom.
+       (bbdb-legal-zip-codes): defcustom.
+       (bbdb-address-editing-function): defcustom.
+
 2001-02-05  Robert Fenk  <[EMAIL PROTECTED]>
 
        * lisp/Makefile.in (bbdb-hooks.elc): removed need to load VM.
cvs server: Diffing bits
cvs server: Diffing bits/bbdb-filters
cvs server: Diffing bits/bbdb-filters/doc
cvs server: Diffing bits/bbdb-filters/doc/formatted
cvs server: Diffing html
cvs server: Diffing html/images
cvs server: Diffing html/patches
cvs server: Diffing lisp
Index: lisp/bbdb-com.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-com.el,v
retrieving revision 1.94
diff -u -r1.94 bbdb-com.el
--- lisp/bbdb-com.el    2001/02/02 14:20:04     1.94
+++ lisp/bbdb-com.el    2001/02/06 20:13:13
@@ -332,15 +332,19 @@
 
 ;;; Parsing other things
 
-(defvar bbdb-expand-mail-aliases t
-  "If non-nil, expand mail aliases in bbdb-complete-name")
+(defcustom bbdb-expand-mail-aliases t
+  "If non-nil, expand mail aliases in bbdb-complete-name"
+  :group 'bbdb-record-use
+  :type 'boolean)
 
-(defvar bbdb-check-zip-codes-p t
+(defcustom bbdb-check-zip-codes-p t
   "If non-nil, require legal zip codes when entering an address.
 The format of legal zip codes is determined by the variable
-`bbdb-legal-zip-codes'.")
+`bbdb-legal-zip-codes'."
+  :group 'bbdb-record-creation
+  :type 'boolean)
 
-(defvar bbdb-legal-zip-codes
+(defcustom bbdb-legal-zip-codes
   '(;; Matches 1 to 6 digits.
     "^[ \t\n]*[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[ \t\n]*$"
     ;; Matches 5 digits and 3 or 4 digits.
@@ -357,7 +361,9 @@
     ;; (result is ("SE" (133 36)))
     "^[ \t\n]*\\([A-Z]+\\)[ \t\n]*-?[ \t\n]*\\([0-9]+\\)[ \t\n]+\\([0-9]+\\)[ 
\t\n]*$")
   "List of regexps that match legal zip codes.
-Wether this is used at all depends on the variable `bbdb-check-zip-codes-p'.")
+Wether this is used at all depends on the variable `bbdb-check-zip-codes-p'."
+  :group 'bbdb-record-creation
+  :type '(repeat regexp))
 
 (defun bbdb-parse-zip-string (string)
   "Check wether STRING is a legal zip code.
@@ -935,11 +941,13 @@
     (bbdb-address-set-country addr country)
     nil))
 
-(defvar bbdb-address-editing-function 'bbdb-address-edit-default
+(defcustom bbdb-address-editing-function 'bbdb-address-edit-default
   "Function to use for address editing.
 The function must accept a BBDB address as parameter and allow the
 user to edit it.  This variable is called from `bbdb-record-edit-address'.
-The default value is the symbol `bbdb-address-edit-default'.")
+The default value is the symbol `bbdb-address-edit-default'."
+  :group 'bbdb-record-creation
+  :type 'function)
 
 (defun bbdb-record-edit-address (addr &optional location)
   "Edit an address ADDR.
Index: lisp/bbdb.el
===================================================================
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb.el,v
retrieving revision 1.132
diff -u -r1.132 bbdb.el
--- lisp/bbdb.el        2001/02/05 11:18:14     1.132
+++ lisp/bbdb.el        2001/02/06 20:13:38
@@ -1021,21 +1021,23 @@
 
 ;;; Address formatting.
 
-(defvar bbdb-address-formatting-alist
+(defcustom bbdb-address-formatting-alist
   '((bbdb-address-is-continental . bbdb-format-address-continental)
     (nil . bbdb-format-address-default))
   "Alist of address identifying and address formatting functions.
 The key is an identifying function which accepts an address.  The
 associated value is a formatting function which inserts the formatted
 address in the current buffer.  If the identifying function returns
-non-nil, the formatting function is called.  The nil key is a default
-value will allways calls the associated formatting function.  Therefore
-you should always have (nil . bbdb-format-address-default) as the last
-element in the alist.
+non-nil, the formatting function is called.  When nil is used as the
+car, then the associated formatting function will always be called.
+Therefore you should always have (nil . bbdb-format-address-default) as
+the last element in the alist.
 
 This alist is used in `bbdb-format-address'.
 
-See also `bbdb-address-print-formatting-alist'.")
+See also `bbdb-address-print-formatting-alist'."
+  :group 'bbdb-record-display
+  :type '(repeat (cons function function)))
 
 (defun bbdb-address-is-continental (addr)
   "Return non-nil if the address ADDR is a continental address.
cvs server: Diffing misc
cvs server: Diffing tex
cvs server: Diffing texinfo
Index: texinfo/bbdb.texinfo
===================================================================
RCS file: /cvsroot/bbdb/bbdb/texinfo/bbdb.texinfo,v
retrieving revision 1.36
diff -u -r1.36 bbdb.texinfo
--- texinfo/bbdb.texinfo        2001/02/02 14:09:14     1.36
+++ texinfo/bbdb.texinfo        2001/02/06 20:14:04
@@ -2083,6 +2083,46 @@
 You can have both styles of phone number in your database by providing a
 prefix argument to the @code{bbdb-insert-new-field} command. @refill
 
+@item bbdb-check-zip-codes-p
+@vindex bbdb-check-zip-codes-p
+@vindex bbdb-legal-zip-codes
+@cindex Zip code checking 
+@cindex Checking zip codes
+@cindex Invalid zip codes
+@cindex Not a valid zip code
+@cindex List of valid zip codes
+@cindex Valid zip codes
+Whether syntax-checking of zip codes should be enforced.  Default:
+@code{t}.  If this is true, you can't enter invalid zip codes.  A zip
+code is valid if it matches one of the regular expressions in the
+variable @code{bbdb-legal-zip-codes}. @refill
+
+@item bbdb-address-formatting-alist
+@vindex bbdb-address-formatting-alist
+@cindex Formatting addresses
+@cindex Display of addresses
+@cindex Address display
+Controls the display of addresses in the buffer.  Each entry in this
+list consists of an identifying function and a formatting function.
+The identifying function must accept an address and return @code{t} if
+the associated formatting function is to be used.  The formatting
+function must insert the formatted address in the current buffer.
+Identifying functions usually base their decision on the zip code
+format or on the country name.  The default entries will format an
+address using continental style if the zip code matches
+@code{bbdb-continental-zip-regexp}.  If the zip code does not match,
+addresses are formatted in US style.
+
+@item bbdb-continental-zip-regexp
+@vindex bbdb-continental-zip-regexp
+@cindex Continental addresses
+@cindex European addresses
+Decides wether an address should be formatted using US or European
+style.  If the zip code of an address matches the regular expression,
+the European style is used.  This works only if the expression
+@code{(bbdb-address-is-continental . bbdb-format-address-continental)}
+is part of @code{bbdb-address-formatting-alist}.
+
 @item bbdb-electric-p
 @vindex bbdb-electric-p
 @cindex Electric display
cvs server: Diffing utils

_______________________________________________
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to