* lsdb.el (lsdb-temp-buffer-show-function): Fix the last change.
[elisp/lsdb.git] / bbdb-to-lsdb.el
1 ;;; bbdb-to-lsdb.el --- the data conversion utility from BBDB to LSDB
2
3 ;; Copyright (C) 2002 Daiki Ueno
4
5 ;; Author: Daiki Ueno <ueno@unixuser.org>
6 ;; Keywords: adress book
7
8 ;; This file is part of the Lovely Sister Database.
9
10 ;; This program is free software; you can redistribute it and/or
11 ;; modify it under the terms of the GNU General Public License as
12 ;; published by the Free Software Foundation; either version 2, or (at
13 ;; your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;;; To convert your ~/.bbdb to ~/.lsdb, type the following command from shell:
28 ;;;   emacs -batch -l ./bbdb-to-lsdb.el
29
30 ;;; Code:
31
32 (require 'bbdb)
33 (require 'lsdb)
34
35 (let ((bbdb-records (bbdb-records))
36       value)
37   (lsdb-maybe-load-hash-tables)
38   (while bbdb-records
39     (when (setq value (bbdb-record-net (car bbdb-records)))
40       (lsdb-update-record
41        (list (or (bbdb-record-name (car bbdb-records))
42                  (car value))
43              (car value))
44        (nconc
45         (if (cdr value)
46             (list (cons 'net (cdr value))))
47         (if (setq value (bbdb-record-aka (car bbdb-records)))
48             (list (cons 'aka value)))
49         (if (setq value (bbdb-record-company (car bbdb-records)))
50             (list (cons 'company value)))
51         (bbdb-record-raw-notes (car bbdb-records)))))
52     (setq bbdb-records (cdr bbdb-records)))
53   (lsdb-mode-save t))
54
55 ;;; bbdb-to-lsdb.el ends here