emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/eudcb-bbdb.el


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/lisp/net/eudcb-bbdb.el
Date: Tue, 04 Feb 2003 08:17:17 -0500

Index: emacs/lisp/net/eudcb-bbdb.el
diff -c emacs/lisp/net/eudcb-bbdb.el:1.4 emacs/lisp/net/eudcb-bbdb.el:1.5
*** emacs/lisp/net/eudcb-bbdb.el:1.4    Wed Jan 16 03:10:15 2002
--- emacs/lisp/net/eudcb-bbdb.el        Tue Feb  4 08:17:16 2003
***************
*** 50,56 ****
  
  (eudc-protocol-set 'eudc-query-function 'eudc-bbdb-query-internal 'bbdb)
  (eudc-protocol-set 'eudc-list-attributes-function nil 'bbdb)
! (eudc-protocol-set 'eudc-protocol-attributes-translation-alist 
                   'eudc-bbdb-attributes-translation-alist 'bbdb)
  (eudc-protocol-set 'eudc-bbdb-conversion-alist nil 'bbdb)
  (eudc-protocol-set 'eudc-protocol-has-default-query-attributes nil 'bbdb)
--- 50,56 ----
  
  (eudc-protocol-set 'eudc-query-function 'eudc-bbdb-query-internal 'bbdb)
  (eudc-protocol-set 'eudc-list-attributes-function nil 'bbdb)
! (eudc-protocol-set 'eudc-protocol-attributes-translation-alist
                   'eudc-bbdb-attributes-translation-alist 'bbdb)
  (eudc-protocol-set 'eudc-bbdb-conversion-alist nil 'bbdb)
  (eudc-protocol-set 'eudc-protocol-has-default-query-attributes nil 'bbdb)
***************
*** 68,90 ****
        (notes (cdr (assq 'notes query)))
        (phone (cdr (assq 'phone query))))
      (list name company net notes phone)))
!       
  
  (defun eudc-bbdb-filter-non-matching-record (record)
    "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise."
    (catch 'unmatch
      (progn
!       (mapcar 
!        (function 
        (lambda (condition)
          (let ((attr (car condition))
                (val (cdr condition))
                (case-fold-search t)
                bbdb-val)
            (or (and (memq attr '(firstname lastname aka company phones 
addresses net))
!                    (progn 
!                      (setq bbdb-val 
!                            (eval (list (intern (concat "bbdb-record-" 
                                                         (symbol-name attr)))
                                         'record)))
                       (if (listp bbdb-val)
--- 68,90 ----
        (notes (cdr (assq 'notes query)))
        (phone (cdr (assq 'phone query))))
      (list name company net notes phone)))
! 
  
  (defun eudc-bbdb-filter-non-matching-record (record)
    "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise."
    (catch 'unmatch
      (progn
!       (mapcar
!        (function
        (lambda (condition)
          (let ((attr (car condition))
                (val (cdr condition))
                (case-fold-search t)
                bbdb-val)
            (or (and (memq attr '(firstname lastname aka company phones 
addresses net))
!                    (progn
!                      (setq bbdb-val
!                            (eval (list (intern (concat "bbdb-record-"
                                                         (symbol-name attr)))
                                         'record)))
                       (if (listp bbdb-val)
***************
*** 108,114 ****
             (if eudc-bbdb-use-locations-as-attribute-names
                 (cons (intern (bbdb-phone-location phone))
                       (bbdb-phone-string phone))
!              (cons 'phones (format "%s: %s" 
                                     (bbdb-phone-location phone)
                                     (bbdb-phone-string phone))))))
          (bbdb-record-phones record)))
--- 108,114 ----
             (if eudc-bbdb-use-locations-as-attribute-names
                 (cons (intern (bbdb-phone-location phone))
                       (bbdb-phone-string phone))
!              (cons 'phones (format "%s: %s"
                                     (bbdb-phone-location phone)
                                     (bbdb-phone-string phone))))))
          (bbdb-record-phones record)))
***************
*** 123,129 ****
                                   (concat s "\n"))
                                 (unless (= 0 (length (setq s 
(bbdb-address-street3 address))))
                                   (concat s "\n"))
!                                (progn 
                                   (setq c (bbdb-address-city address))
                                   (setq s (bbdb-address-state address))
                                   (if (and (> (length c) 0) (> (length s) 0))
--- 123,129 ----
                                   (concat s "\n"))
                                 (unless (= 0 (length (setq s 
(bbdb-address-street3 address))))
                                   (concat s "\n"))
!                                (progn
                                   (setq c (bbdb-address-city address))
                                   (setq s (bbdb-address-state address))
                                   (if (and (> (length c) 0) (> (length s) 0))
***************
*** 143,149 ****
        attr
        eudc-rec
        val)
!     (while (prog1 
               (setq attr (car attrs))
             (setq attrs (cdr attrs)))
        (cond
--- 143,149 ----
        attr
        eudc-rec
        val)
!     (while (prog1
               (setq attr (car attrs))
             (setq attrs (cdr attrs)))
        (cond
***************
*** 152,166 ****
         ((eq attr 'addresses)
        (setq val (eudc-bbdb-extract-addresses record)))
         ((memq attr '(firstname lastname aka company net notes))
!       (setq val (eval 
!                  (list (intern 
!                         (concat "bbdb-record-" 
                                  (symbol-name attr)))
                         'record))))
         (t
        (setq val "Unknown BBDB attribute")))
        (if val
!       (cond 
         ((memq attr '(phones addresses))
          (setq eudc-rec (append val eudc-rec)))
         ((and (listp val)
--- 152,166 ----
         ((eq attr 'addresses)
        (setq val (eudc-bbdb-extract-addresses record)))
         ((memq attr '(firstname lastname aka company net notes))
!       (setq val (eval
!                  (list (intern
!                         (concat "bbdb-record-"
                                  (symbol-name attr)))
                         'record))))
         (t
        (setq val "Unknown BBDB attribute")))
        (if val
!       (cond
         ((memq attr '(phones addresses))
          (setq eudc-rec (append val eudc-rec)))
         ((and (listp val)
***************
*** 171,184 ****
         (t
          (error "Unexpected attribute value")))))
      (nreverse eudc-rec)))
!       
  
  
  (defun eudc-bbdb-query-internal (query &optional return-attrs)
    "Query BBDB  with QUERY.
! QUERY is a list of cons cells (ATTR . VALUE) where ATTRs should be valid 
! BBDB attribute names.  
! RETURN-ATTRS is a list of attributes to return, defaulting to 
  `eudc-default-return-attributes'."
  
    (let ((eudc-bbdb-current-query query)
--- 171,184 ----
         (t
          (error "Unexpected attribute value")))))
      (nreverse eudc-rec)))
! 
  
  
  (defun eudc-bbdb-query-internal (query &optional return-attrs)
    "Query BBDB  with QUERY.
! QUERY is a list of cons cells (ATTR . VALUE) where ATTRs should be valid
! BBDB attribute names.
! RETURN-ATTRS is a list of attributes to return, defaulting to
  `eudc-default-return-attributes'."
  
    (let ((eudc-bbdb-current-query query)
***************
*** 202,216 ****
               ;; If there were duplicate attributes reverse the order of the
               ;; record so the unique attributes appear first
               (if (> (length filtered) 1)
!                  (setq filtered (mapcar (function 
                                           (lambda (rec)
                                             (reverse rec)))
                                          filtered)))
               (setq result (append result filtered))))
            (delq nil
!                 (mapcar 'eudc-bbdb-format-record-as-result 
!                         (delq nil 
!                               (mapcar 'eudc-bbdb-filter-non-matching-record 
                                        records)))))
      result))
  
--- 202,216 ----
               ;; If there were duplicate attributes reverse the order of the
               ;; record so the unique attributes appear first
               (if (> (length filtered) 1)
!                  (setq filtered (mapcar (function
                                           (lambda (rec)
                                             (reverse rec)))
                                          filtered)))
               (setq result (append result filtered))))
            (delq nil
!                 (mapcar 'eudc-bbdb-format-record-as-result
!                         (delq nil
!                               (mapcar 'eudc-bbdb-filter-non-matching-record
                                        records)))))
      result))
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]