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

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

[elpa] scratch/org-contacts-rebased 543f2c5 045/118: contrib/lisp/org-co


From: Stefan Monnier
Subject: [elpa] scratch/org-contacts-rebased 543f2c5 045/118: contrib/lisp/org-contacts.el: Remove calls to cl functions
Date: Fri, 12 Nov 2021 15:37:01 -0500 (EST)

branch: scratch/org-contacts-rebased
commit 543f2c55527e6f3098bc3551c6f1b4dbbf85e75d
Author: Grégoire Jadi <gregoire.jadi@gmail.com>
Commit: Grégoire Jadi <gregoire.jadi@gmail.com>

    contrib/lisp/org-contacts.el: Remove calls to cl functions
    
    * contrib/lisp/org-contacts.el(org-contacts-test-completion-prefix)
    (org-contacts-complete-name, org-contacts-db-need-update-p)
    (org-contacts-filter): Remove calls to cl functions.
---
 org-contacts.el | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 65afe73..0c5a9cf 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -165,10 +165,10 @@ This overrides `org-email-link-description-format' if 
set."
 (defun org-contacts-db-need-update-p ()
   "Determine whether `org-contacts-db' needs to be refreshed."
   (or (null org-contacts-last-update)
-      (some (lambda (file)
-             (or (time-less-p org-contacts-last-update
-                              (elt (file-attributes file) 5))))
-           (org-contacts-files))))
+      (org-find-if (lambda (file)
+                    (or (time-less-p org-contacts-last-update
+                                     (elt (file-attributes file) 5))))
+                  (org-contacts-files))))
 
 (defun org-contacts-db ()
   "Return the latest Org Contacts Database."
@@ -207,10 +207,10 @@ If both match values are nil, return all contacts."
                   (org-string-match-p name-match
                                       (first contact)))
              (and tags-match
-                  (some (lambda (tag)
-                          (org-string-match-p tags-match tag))
-                        (org-split-string
-                         (or (cdr (assoc-string "ALLTAGS" (caddr contact))) 
"") ":"))))
+                  (org-find-if (lambda (tag)
+                                 (org-string-match-p tags-match tag))
+                               (org-split-string
+                                (or (cdr (assoc-string "ALLTAGS" (caddr 
contact))) "") ":"))))
          collect contact)))
 
 (when (not (fboundp 'completion-table-case-fold))
@@ -369,10 +369,13 @@ prefixes rather than just the beginning of the string."
          completions))
 
 (defun org-contacts-test-completion-prefix (string collection predicate)
-  (find-if (lambda (el)
-            (and (or (null predicate) (funcall predicate el))
-                 (string= string el)))
-          collection))
+  ;; Prevents `org-find-if' from redefining `predicate' and going into
+  ;; an infinite loop.
+  (lexical-let ((predicate predicate))
+    (org-find-if (lambda (el)
+                  (and (or (null predicate) (funcall predicate el))
+                       (string= string el)))
+                collection)))
 
 (defun org-contacts-boundaries-prefix (string collection predicate suffix)
   (list* 'boundaries (completion-boundaries string collection predicate 
suffix)))
@@ -444,7 +447,7 @@ A group FOO is composed of contacts with the tag FOO."
                            collect (org-contacts-format-email contact-name 
email))))
         (completion-list (org-contacts-all-completions-prefix
                           string
-                          (remove-duplicates completion-list :test #'equalp))))
+                          (org-uniquify completion-list))))
     (when completion-list
       (list start end
            (org-contacts-make-collection-prefix completion-list)))))



reply via email to

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