-
Notifications
You must be signed in to change notification settings - Fork 4
/
lbdb_bbdb_query.el
36 lines (31 loc) · 1.05 KB
/
lbdb_bbdb_query.el
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
;;; query the bbdb for all records matching a given string; return them
;;; in lbdb-suitable format
;;;
;;; This code is (c) Utz-Uwe Haus <[email protected]> 2001
;;; Use, reuse and deletion are permitted in any way you can up with.
(require 'bbdb)
(require 'bbdb-com)
(defun lbdb-bbdb-query (string)
"Display all entries in the BBDB matching STRING in the Name, Company or
email fields in lbdb-usable format, i.e.
<email-address>[TAB]<Full Name>[TAB]<comment>
where <comment> is BBDB:timestamp."
(let ((matches
(bbdb-search (bbdb-records) string string string nil nil))
(result ""))
(mapcar
(lambda (record)
(let ((name (bbdb-record-name record))
(timestamp (bbdb-record-getprop record 'timestamp)))
(mapcar
(lambda (this-email)
(setq result
(concat result
(format "%s\t%s\tBBDB:%s\n" this-email name timestamp))))
(bbdb-record-net record))))
matches)
(princ result)))
;; the princ is for for emacs and xemacs, return value is for gnuclient
(provide 'lbdb-bbdb-query)
; use like:
;(lbdb-bbdb-query "grae")