blob: e46fb2c99086b42300ee74c722f6ded46d963e69 (
plain)
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
56
57
58
59
60
|
;; Essential add-on for BBDB
(defun bbdb-create-external ()
"Prompt for and create a record. Hacked from bbdb-read-new-record."
(interactive)
(let ((name (bbdb-read-string "Name: "))
(company (bbdb-read-string "Company: "))
(net (bbdb-split (bbdb-read-string "Network Address: ") ","))
(addrs
(let (L L-tail str addr)
(while
(not
(string=
""
(setq str
(bbdb-read-string
"Address Description [RET when no more addrs]: "))))
(setq addr (make-vector bbdb-address-length nil))
(bbdb-record-edit-address addr str)
(if L
(progn (setcdr L-tail (cons addr nil))
(setq L-tail (cdr L-tail)))
(setq L (cons addr nil)
L-tail L)))
L))
(phones
(let (L L-tail str)
(while
(not
(string=
""
(setq str
(bbdb-read-string
"Phone Location [RET when no more phones]: "))))
(let* ((phonelist
(bbdb-error-retry
(bbdb-parse-phone-number
(read-string
"Phone: "
(and
bbdb-default-area-code
(format "(%03d) " bbdb-default-area-code))))))
(phone (apply 'vector str
(if (= 3 (length phonelist))
(nconc phonelist '(0))
phonelist))))
(if L
(progn (setcdr L-tail (cons phone nil))
(setq L-tail (cdr L-tail)))
(setq L (cons phone nil)
L-tail L))))
L))
(notes (bbdb-read-string "Additional Comments: " "[M][F]")))
(if (string= company "") (setq company nil))
(if (string= name "") (setq name nil))
(if (string= notes "") (setq notes nil))
(bbdb-display-records
(list
(bbdb-create-internal name company net addrs phones notes)))))
(global-set-key [f12] 'bbdb-create-external)
|