emacs-diffs
[Top][All Lists]
Advanced

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

master 8caa91b2ce 1/3: * lisp/vc/pcvs-util.el (cvs-partition): Simplify.


From: Stefan Kangas
Subject: master 8caa91b2ce 1/3: * lisp/vc/pcvs-util.el (cvs-partition): Simplify.
Date: Tue, 9 Aug 2022 16:38:21 -0400 (EDT)

branch: master
commit 8caa91b2ce4a27a9a11d8a7cf190a15b136768e7
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    * lisp/vc/pcvs-util.el (cvs-partition): Simplify.
---
 lisp/vc/pcvs-util.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index 702033dd88..89f8d26880 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -38,6 +38,7 @@
   (apply #'append (mapcar (lambda (x) (if (listp x) x (list x))) xs)))
 
 (defun cvs-first (l &optional n)
+  ;; FIXME: Replace this with `seq-take'?
   (if (null n) (car l)
     (when l
       (let* ((nl (list (pop l)))
@@ -53,10 +54,9 @@
 The function returns a `cons' cell where the `car' contains
 elements of L for which P is true while the `cdr' contains
 the other elements.  The ordering among elements is maintained."
-  (let (car cdr)
-    (dolist (x l)
-      (if (funcall p x) (push x car) (push x cdr)))
-    (cons (nreverse car) (nreverse cdr))))
+  (let ((res (seq-group-by p l)))
+    (cons (cdr (assq t res))
+          (cdr (assq nil res)))))
 
 ;;;
 ;;; frame, window, buffer handling



reply via email to

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