File: bbdb-to-lsdb.el

package info (click to toggle)
lsdb 0.11-10
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 176 kB
  • ctags: 163
  • sloc: lisp: 1,671; sh: 77; makefile: 37
file content (55 lines) | stat: -rw-r--r-- 1,800 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; bbdb-to-lsdb.el --- the data conversion utility from BBDB to LSDB

;; Copyright (C) 2002 Daiki Ueno

;; Author: Daiki Ueno <ueno@unixuser.org>
;; Keywords: adress book

;; This file is part of the Lovely Sister Database.

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.

;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;; Commentary:

;;; To convert your ~/.bbdb to ~/.lsdb, type the following command from shell:
;;;   emacs -batch -l ./bbdb-to-lsdb.el

;;; Code:

(require 'bbdb)
(require 'lsdb)

(let ((bbdb-records (bbdb-records))
      value)
  (lsdb-maybe-load-hash-tables)
  (while bbdb-records
    (when (setq value (bbdb-record-net (car bbdb-records)))
      (lsdb-update-record
       (list (or (bbdb-record-name (car bbdb-records))
		 (car value))
	     (car value))
       (nconc
	(if (cdr value)
	    (list (cons 'net (cdr value))))
	(if (setq value (bbdb-record-aka (car bbdb-records)))
	    (list (cons 'aka value)))
	(if (setq value (bbdb-record-company (car bbdb-records)))
	    (list (cons 'company value)))
	(bbdb-record-raw-notes (car bbdb-records)))))
    (setq bbdb-records (cdr bbdb-records)))
  (lsdb-mode-save t))

;;; bbdb-to-lsdb.el ends here