]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/gnorb/gnorb-bbdb.el
Merge commit '37c46180280f10fa5120a017acd04f7022d124e4'
[gnu-emacs-elpa] / packages / gnorb / gnorb-bbdb.el
index eb2f6eb02511f615aa662c7ebcceb647a2a37d3c..306ea01521f11b308a97a5f2560df2690bfba552 100644 (file)
@@ -255,24 +255,34 @@ is non-nil (as in interactive calls) be verbose."
        (unless (fboundp field)
          ;; what's the record's existing value for this field?
          (setq rec-val (bbdb-record-field r field)))
-       (when (cond
-              ((eq field 'address)
-               (dolist (a rec-val)
-                 (unless (and label
-                              (not (string-match label (car a))))
-                   (string-match val (bbdb-format-address-default a)))))
-              ((eq field 'phone)
-               (dolist (p rec-val)
-                 (unless (and label
-                              (not (string-match label (car p))))
-                   (string-match val (bbdb-phone-string p)))))
-              ((consp rec-val)
-               (dolist (f rec-val)
-                 (string-match val f)))
-              ((fboundp field)
-               (funcall field r))
-              ((stringp rec-val)
-               (string-match val rec-val)))
+       (when (catch 'match
+               (cond
+                ((eq field 'address)
+                 (dolist (a rec-val)
+                   (unless (and label
+                                (not (string-match label (car a))))
+                     (when
+                         (string-match-p
+                          val
+                          (bbdb-format-address-default a))
+                       (throw 'match t)))))
+                ((eq field 'phone)
+                 (dolist (p rec-val)
+                   (unless (and label
+                                (not (string-match label (car p))))
+                     (when
+                         (string-match-p val (bbdb-phone-string p))
+                       (throw 'match t)))))
+                ((consp rec-val)
+                 (dolist (f rec-val)
+                   (when (string-match-p val f)
+                     (throw 'match t))))
+                ((fboundp field)
+                 (when (string-match-p (funcall field r))
+                   (throw 'match t)))
+                ((stringp rec-val)
+                 (when (string-match-p val rec-val)
+                   (throw 'match t)))))
          ;; there are matches, run through the field setters in last
          ;; element of the sexp
          (dolist (attribute style)