Function: eudc-bbdbify-phone

eudc-bbdbify-phone is a byte-compiled function defined in eudc-export.el.gz.

Signature

(eudc-bbdbify-phone PHONE LOCATION)

Documentation

Parse PHONE into a vector compatible with 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.

Source Code

;; Defined in /usr/src/emacs/lisp/net/eudc-export.el.gz
(defun eudc-bbdbify-phone (phone location)
  "Parse PHONE into a vector compatible with 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)
      (condition-case err
	  (setq phone-list (if (eudc--using-bbdb-3-or-newer-p)
			       (bbdb-parse-phone phone)
			     (bbdb-parse-phone-number phone)))
	(error
	 (if (string= "phone number unparsable." (cadr err))
	     (if (not (y-or-n-p (format "BBDB claims %S to be unparsable--insert anyway? " phone)))
		 (error "Phone number unparsable")
	       (setq phone-list (list (bbdb-string-trim phone))))
	   (signal (car err) (cdr err)))))
      (if (= 3 (length phone-list))
	  (setq phone-list (append phone-list '(nil))))
      (apply #'vector location phone-list)))
   ((listp phone)
    (vector location (mapconcat #'identity phone ", ")))
   (t
    (error "Invalid phone specification"))))