]> git.eshelyaron.com Git - emacs.git/commitdiff
Make ibuffer-split-list obsolete in favor of seq-group-by
authorStefan Kangas <stefan@marxist.se>
Tue, 9 Aug 2022 13:37:53 +0000 (15:37 +0200)
committerStefan Kangas <stefan@marxist.se>
Tue, 9 Aug 2022 13:37:53 +0000 (15:37 +0200)
* lisp/ibuf-ext.el (ibuffer-split-list): Make obsolete in favor of
'seq-group-by'.
(ibuffer-generate-filter-groups): Don't use above obsolete
function.

lisp/ibuf-ext.el

index 822ecbdd99ddaa767e894574f9c85fdad838d867..3fa17e583d2ee8a5d8cc17e3bd80f3805459f123 100644 (file)
       (setq tail (cdr tail)))
     (nreverse new)))
 
-(defun ibuffer-split-list (ibuffer-split-list-fn ibuffer-split-list-elts)
-  (let ((hip-crowd nil)
-       (lamers nil))
-    (dolist (ibuffer-split-list-elt ibuffer-split-list-elts)
-      (if (funcall ibuffer-split-list-fn ibuffer-split-list-elt)
-         (push ibuffer-split-list-elt hip-crowd)
-       (push ibuffer-split-list-elt lamers)))
-    ;; Too bad Emacs Lisp doesn't have multiple values.
-    (list (nreverse hip-crowd) (nreverse lamers))))
+(defun ibuffer-split-list (fn elts)
+  (declare (obsolete seq-group-by "29.1"))
+  (let ((res (seq-group-by fn elts)))
+    (list (cdr (assq t res)) (cdr (assq nil res)))))
 
 (defcustom ibuffer-never-show-predicates nil
   "A list of predicates (a regexp or function) for buffers not to display.
@@ -769,11 +764,12 @@ specification, with the same structure as an element of the list
          (i 0))
       (dolist (filtergroup filter-group-alist)
        (let ((filterset (cdr filtergroup)))
-         (cl-destructuring-bind (hip-crowd lamers)
-             (ibuffer-split-list (lambda (bufmark)
-                                   (ibuffer-included-in-filters-p (car bufmark)
-                                                                  filterset))
-                                 bmarklist)
+          (let* ((res (seq-group-by (lambda (bufmark)
+                                      (ibuffer-included-in-filters-p (car bufmark)
+                                                                     filterset))
+                                    bmarklist))
+                 (hip-crowd (cdr (assq t res)))
+                 (lamers (cdr (assq nil res))))
            (aset vec i hip-crowd)
            (cl-incf i)
            (setq bmarklist lamers))))