emacs-diffs
[Top][All Lists]
Advanced

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

master 15dc22124cb 1/2: Replace completion--some with seq-some


From: Stefan Kangas
Subject: master 15dc22124cb 1/2: Replace completion--some with seq-some
Date: Sun, 3 Sep 2023 06:28:40 -0400 (EDT)

branch: master
commit 15dc22124cb6157083e6be298776f672bfdf9c1c
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Replace completion--some with seq-some
    
    This is safe, as 'seq' is preloaded before 'minibuffer'.
    * lisp/loadup.el ("minibuffer"): Document 'seq' dependency.
    * lisp/minibuffer.el (completion--some): Remove.  Replace all uses
    with 'seq-some'.
---
 lisp/loadup.el     |  2 +-
 lisp/minibuffer.el | 27 +++++++--------------------
 2 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/lisp/loadup.el b/lisp/loadup.el
index 38fb0fc1fa9..35c59dba453 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -248,7 +248,7 @@
 (load "simple")
 (load "emacs-lisp/seq")
 (load "emacs-lisp/nadvice")
-(load "minibuffer") ;Needs cl-generic (and define-minor-mode).
+(load "minibuffer") ; Needs cl-generic, seq (and define-minor-mode).
 (load "frame")
 (load "startup")
 (load "term/tty-colors")
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 35b359a75e2..5d7cbcedd41 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -153,19 +153,6 @@ The metadata of a completion table should be constant 
between two boundaries."
 (defun completion-metadata-get (metadata prop)
   (cdr (assq prop metadata)))
 
-(defun completion--some (fun xs)
-  "Apply FUN to each element of XS in turn.
-Return the first non-nil returned value.
-Like CL's `some'."
-  (let ((firsterror nil)
-        res)
-    (while (and (not res) xs)
-      (condition-case-unless-debug err
-          (setq res (funcall fun (pop xs)))
-        (error (unless firsterror (setq firsterror err)) nil)))
-    (or res
-        (if firsterror (signal (car firsterror) (cdr firsterror))))))
-
 (defun complete-with-action (action collection string predicate)
   "Perform completion according to ACTION.
 STRING, COLLECTION and PREDICATE are used as in `try-completion'.
@@ -426,9 +413,9 @@ obeys predicates."
   ;; is returned by TABLE2 (because TABLE1 returned an empty list).
   ;; Same potential problem if any of the tables use quoting.
   (lambda (string pred action)
-    (completion--some (lambda (table)
-                        (complete-with-action action table string pred))
-                      tables)))
+    (seq-some (lambda (table)
+                (complete-with-action action table string pred))
+              tables)))
 
 (defun completion-table-merge (&rest tables)
   "Create a completion table that collects completions from all TABLES."
@@ -451,9 +438,9 @@ obeys predicates."
                                 (all-completions string table pred))
                               tables)))
      (t
-      (completion--some (lambda (table)
-                          (complete-with-action action table string pred))
-                        tables)))))
+      (seq-some (lambda (table)
+                  (complete-with-action action table string pred))
+                tables)))))
 
 (defun completion-table-with-quoting (table unquote requote)
   ;; A difficult part of completion-with-quoting is to map positions in the
@@ -1216,7 +1203,7 @@ overrides the default specified in 
`completion-category-defaults'."
               (cl-assert (<= point (length string)))
               (pop new))))
          (result-and-style
-          (completion--some
+          (seq-some
            (lambda (style)
              (let ((probe (funcall
                            (or (nth n (assq style completion-styles-alist))



reply via email to

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