Mercurial > emacs
comparison lisp/net/eudcb-bbdb.el @ 85228:631c2c083474
(eudc-bbdb-filter-non-matching-record)
(eudc-bbdb-query-internal): Use mapc rather than mapcar.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 13 Oct 2007 03:02:35 +0000 |
parents | 84cf1e2214c5 |
children | 4a5a63e12e5a d38543a1c0f9 |
comparison
equal
deleted
inserted
replaced
85227:d1f4134ad896 | 85228:631c2c083474 |
---|---|
73 | 73 |
74 (defun eudc-bbdb-filter-non-matching-record (record) | 74 (defun eudc-bbdb-filter-non-matching-record (record) |
75 "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." | 75 "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." |
76 (catch 'unmatch | 76 (catch 'unmatch |
77 (progn | 77 (progn |
78 (mapcar | 78 (mapc |
79 (function | 79 (function |
80 (lambda (condition) | 80 (lambda (condition) |
81 (let ((attr (car condition)) | 81 (let ((attr (car condition)) |
82 (val (cdr condition)) | 82 (val (cdr condition)) |
83 (case-fold-search t) | 83 (case-fold-search t) |
195 (while (and records (> (length query-attrs) 0)) | 195 (while (and records (> (length query-attrs) 0)) |
196 (setq bbdb-attrs (append bbdb-attrs (list (car query-attrs)))) | 196 (setq bbdb-attrs (append bbdb-attrs (list (car query-attrs)))) |
197 (if (car query-attrs) | 197 (if (car query-attrs) |
198 (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs)))) | 198 (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs)))) |
199 (setq query-attrs (cdr query-attrs))) | 199 (setq query-attrs (cdr query-attrs))) |
200 (mapcar (function | 200 (mapc (function |
201 (lambda (record) | 201 (lambda (record) |
202 (setq filtered (eudc-filter-duplicate-attributes record)) | 202 (setq filtered (eudc-filter-duplicate-attributes record)) |
203 ;; If there were duplicate attributes reverse the order of the | 203 ;; If there were duplicate attributes reverse the order of the |
204 ;; record so the unique attributes appear first | 204 ;; record so the unique attributes appear first |
205 (if (> (length filtered) 1) | 205 (if (> (length filtered) 1) |
206 (setq filtered (mapcar (function | 206 (setq filtered (mapcar (function |
207 (lambda (rec) | 207 (lambda (rec) |
208 (reverse rec))) | 208 (reverse rec))) |
209 filtered))) | 209 filtered))) |
210 (setq result (append result filtered)))) | 210 (setq result (append result filtered)))) |
211 (delq nil | 211 (delq nil |
212 (mapcar 'eudc-bbdb-format-record-as-result | 212 (mapcar 'eudc-bbdb-format-record-as-result |
213 (delq nil | 213 (delq nil |
214 (mapcar 'eudc-bbdb-filter-non-matching-record | 214 (mapcar 'eudc-bbdb-filter-non-matching-record |
215 records))))) | 215 records))))) |
216 result)) | 216 result)) |
217 | 217 |
218 ;;}}} | 218 ;;}}} |
219 | 219 |
220 ;;{{{ High-level interfaces (interactive functions) | 220 ;;{{{ High-level interfaces (interactive functions) |