emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/gnorb 87137be 330/449: gnorb-bbdb.el: Fix matching of p


From: Stefan Monnier
Subject: [elpa] externals/gnorb 87137be 330/449: gnorb-bbdb.el: Fix matching of posting styles
Date: Fri, 27 Nov 2020 23:16:05 -0500 (EST)

branch: externals/gnorb
commit 87137befe8cd737242cb7f798b45b416c9cd2082
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    gnorb-bbdb.el: Fix matching of posting styles
    
    * gnorb-bbdb.el (gnorb-bbdb-configure-posting-styles): I had been
      mishandling the return value of dolist. Also switch to using
      string-match-p rather than string-match.
---
 gnorb-bbdb.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/gnorb-bbdb.el b/gnorb-bbdb.el
index eb2f6eb..35b2ff3 100644
--- a/gnorb-bbdb.el
+++ b/gnorb-bbdb.el
@@ -244,7 +244,7 @@ is non-nil (as in interactive calls) be verbose."
 (defun gnorb-bbdb-configure-posting-styles (recs)
   ;; My most magnificent work of copy pasta!
   (dolist (r recs)
-    (let (field val label rec-val element filep
+    (let (field val label rec-val element filep matchp
                element v value results name address)
       (dolist (style gnorb-bbdb-posting-styles)
        (setq field (pop style)
@@ -257,22 +257,26 @@ is non-nil (as in interactive calls) be verbose."
          (setq rec-val (bbdb-record-field r field)))
        (when (cond
               ((eq field 'address)
-               (dolist (a rec-val)
+               (dolist (a rec-val matchp)
                  (unless (and label
                               (not (string-match label (car a))))
-                   (string-match val (bbdb-format-address-default a)))))
+                   (setq matchp
+                         (string-match-p
+                          val
+                          (bbdb-format-address-default a))))))
               ((eq field 'phone)
-               (dolist (p rec-val)
+               (dolist (p rec-val matchp)
                  (unless (and label
                               (not (string-match label (car p))))
-                   (string-match val (bbdb-phone-string p)))))
+                   (setq matchp
+                         (string-match-p val (bbdb-phone-string p))))))
               ((consp rec-val)
-               (dolist (f rec-val)
-                 (string-match val f)))
+               (dolist (f rec-val matchp)
+                 (setq matchp (string-match-p val f))))
               ((fboundp field)
-               (funcall field r))
+               (setq matchp (funcall field r)))
               ((stringp rec-val)
-               (string-match val rec-val)))
+               (setq matchp (string-match-p val rec-val))))
          ;; there are matches, run through the field setters in last
          ;; element of the sexp
          (dolist (attribute style)



reply via email to

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