1 ;;; -*- Mode:Emacs-Lisp -*-
3 ;;; This file is part of the Insidious Big Brother Database (aka BBDB),
4 ;;; Copyright (c) 2000 Alex Schroeder
6 ;;; The Insidious Big Brother Database is free software; you can redistribute
7 ;;; it and/or modify it under the terms of the GNU General Public License as
8 ;;; published by the Free Software Foundation; either version 2, or (at your
9 ;;; option) any later version.
11 ;;; BBDB is distributed in the hope that it will be useful, but WITHOUT ANY
12 ;;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 ;;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Emacs; see the file COPYING. If not, write to
18 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 (defun bbdb-unmigrate-stuff (&optional new-version)
21 "Create a buffer with unmigrated BBDB data.
22 Usefull if you fooled around with BBDB file format 4 by Alex and want to
23 start using the official BBDB 2.00.06 again. In order to do that, you
24 have to save your .bbdb in BBDB file format 3 instead of the file format 4
25 introduced by Alex. This function will create a *BBDB Version 3* buffer
26 for you, which you can examine and save as your new .bbdb. The unmigration
27 will strip the country fields of all entries in your BBDB as such a field
28 did not exist in the BBDB file format 3 used in BBDB 2.00.06."
29 (interactive "nUnmigrate to version (I recommend version 3): ")
30 (if (null new-version)
32 (if (>= new-version bbdb-file-format)
33 (error "Current BBDB file format is version %d" bbdb-file-format)
34 (let* ((records (bbdb-records))
35 (propnames (bbdb-with-db-buffer bbdb-propnames))
37 (bbdb-file-format-migration (cons bbdb-file-format new-version))
38 (buf (get-buffer-create (format "*BBDB Version %d*" (cdr bbdb-file-format-migration)))))
39 (message "Unconverting the BBDB database...")
42 (insert (format (concat ";;; file-version: %d\n"
43 ";;; user-fields: %S\n")
44 new-version (mapcar (function (lambda (x) (intern (car x))))
47 (setq rec (copy-sequence (car records)))
48 (bbdb-unmigrate-record rec)
50 (insert (format "%S\n" rec))
51 (setq records (cdr records)))
53 (message "Unconverting the BBDB database...done"))))