Here is a patch which keeps track of the last declined migrate
version and stores it with the customized variables.  This prevents
BBDB from prompting about the same upgrade on successive starts.
Drawbacks include:

 o only tested on XEmacs-21.4.6 with a modern custom.el
 o ugly variable names

I know less than nothing about Customize, so I've probably done
something boneheaded in this.  But it works for me.

2002-03-02  Samuel Mikes  <[EMAIL PROTECTED]>

        * lisp/bbdb-migrate.el (bbdb-migration-query): store highest
        declined version

        * lisp/bbdb.el (bbdb-highest-format-declined): defcustom to keep
        track of user's refusal to upgrade
        (parse-bbdb-internal) check if user has declined this upgrade
        before prompting with bbdb-query-migration

Index: bbdb.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/bbdb/lisp/bbdb.el,v
retrieving revision 1.8
diff -u -r1.8 bbdb.el
--- bbdb.el     2002/02/12 22:56:39     1.8
+++ bbdb.el     2002/03/02 18:43:48
@@ -305,6 +305,13 @@
   :group 'bbdb-database
   :type 'boolean)
 
+(defcustom bbdb-highest-format-declined 0
+  "*Newest version of database file format that has been declined for migration.
+When bbdb-file-format is not greater than this, BBDB will not offer
+to automatically migrate your database."
+  :group 'bbdb-database
+  :type 'integer)
+
 (unless (fboundp 'primep)
   (defun primep (num)
     (let ((lim (sqrt num)) (nu 2) (prime t))
@@ -2244,8 +2251,11 @@
                     (format
                      "BBDB file format has changed on disk from %d to %d!"
                      (car bbdb-file-format-migration) v)))
-               (setq bbdb-file-format-migration
-                     (cons v (bbdb-migration-query v)))))
+             (setq bbdb-file-format-migration
+                   (cons v
+                         (if (>= bbdb-highest-format-declined bbdb-file-format)
+                             v
+                           (bbdb-migration-query v))))))
           ((> v bbdb-file-format)
            (error "BBDB version %s doesn't understand file format version %s."
                   bbdb-version v))
--- bbdb-migrate.el.yes Sat Mar  2 11:37:43 2002
+++ bbdb-migrate.el     Sat Mar  2 10:48:05 2002
@@ -430,6 +430,12 @@
         (yes-or-no-p (concat "Upgrade BBDB to version "
                   (format "%d" bbdb-file-format)
                   "? ")))
+      (and (not update)
+           (not (y-or-n-p (format "Keep asking about upgrades to version %d? "
+                             bbdb-file-format)))
+           (custom-set-variables (list 'bbdb-highest-format-declined
+                                       bbdb-file-format))
+           (custom-save-variables))
       (delete-window win)
       (kill-buffer buf)
       (set-window-configuration wc)

-- 
Sam Mikes
[EMAIL PROTECTED]

Reply via email to