X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/84eb0351d8be4811897c8cf62a69757ff5d14001..816cad6e2414474b06ebb4f691fc1bdb9a8953a4:/lisp/net/eudc-export.el diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el index df3a2e0411..9ce623b9ba 100644 --- a/lisp/net/eudc-export.el +++ b/lisp/net/eudc-export.el @@ -1,9 +1,9 @@ -;;; eudc-export.el --- functions to export EUDC query results +;;; eudc-export.el --- functions to export EUDC query results -*- coding: utf-8 -*- -;; Copyright (C) 1998-2011 Free Software Foundation, Inc. +;; Copyright (C) 1998-2014 Free Software Foundation, Inc. ;; Author: Oscar Figueiredo -;; Maintainer: Pavel Janík +;; Maintainer: Pavel Janík ;; Keywords: comm ;; Package: eudc @@ -31,20 +31,20 @@ (require 'eudc) -(if (not (featurep 'bbdb)) - (load-library "bbdb")) -(if (not (featurep 'bbdb-com)) - (load-library "bbdb-com")) +;; NOERROR is so we can compile it. +(require 'bbdb nil t) +(require 'bbdb-com nil t) (defun eudc-create-bbdb-record (record &optional silent) "Create a BBDB record using the RECORD alist. RECORD is an alist of (KEY . VALUE) where KEY is a directory attribute name symbol and VALUE is the corresponding value for the record. If SILENT is non-nil then the created BBDB record is not displayed." + (require 'bbdb) ;; This function runs in a special context where lisp symbols corresponding ;; to field names in record are bound to the corresponding values (eval - `(let* (,@(mapcar '(lambda (c) + `(let* (,@(mapcar (lambda (c) (list (car c) (if (listp (cdr c)) (list 'quote (cdr c)) (cdr c)))) @@ -108,7 +108,7 @@ If RECURSE is non-nil then SPEC may be a list of atomic specs." (void-variable nil))) ((and recurse (listp spec)) - (mapcar '(lambda (spec-elem) + (mapcar (lambda (spec-elem) (eudc-parse-spec spec-elem record nil)) spec)) (t @@ -128,7 +128,7 @@ LOCATION is used as the address location for bbdb." zip city state) (setq addr-components (nreverse addr-components)) ;; If not containing the zip code the last line is supposed to contain a - ;; country name and the addres is supposed to be in european style + ;; country name and the address is supposed to be in european style (if (not (string-match "[0-9][0-9][0-9]" last1)) (progn (setq state last1) @@ -166,6 +166,7 @@ LOCATION is used as the address location for bbdb." PHONE is either a string supposedly containing a phone number or a list of such strings which are concatenated. LOCATION is used as the phone location for BBDB." + (require 'bbdb) (cond ((stringp phone) (let (phone-list) @@ -188,6 +189,7 @@ LOCATION is used as the phone location for BBDB." (defun eudc-batch-export-records-to-bbdb () "Insert all the records returned by a directory query into BBDB." (interactive) + (require 'bbdb) (goto-char (point-min)) (let ((nbrec 0) record) @@ -203,6 +205,7 @@ LOCATION is used as the phone location for BBDB." "Insert record at point into the BBDB database. This function can only be called from a directory query result buffer." (interactive) + (require 'bbdb) (let ((record (and (overlays-at (point)) (overlay-get (car (overlays-at (point))) 'eudc-record)))) (if (null record) @@ -213,9 +216,8 @@ This function can only be called from a directory query result buffer." (defun eudc-try-bbdb-insert () "Call `eudc-insert-record-at-point-into-bbdb' if on a record." (interactive) - (and (or (featurep 'bbdb) - (prog1 (locate-library "bbdb") (message ""))) - (overlays-at (point)) + (require 'bbdb) + (and (overlays-at (point)) (overlay-get (car (overlays-at (point))) 'eudc-record) (eudc-insert-record-at-point-into-bbdb)))