From d3f6edf5aa0a7083efa2dd08ed3eb7d8709689c8 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 9 Aug 2022 15:37:53 +0200 Subject: [PATCH] Make ibuffer-split-list obsolete in favor of seq-group-by * 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 | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 822ecbdd99d..3fa17e583d2 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -63,15 +63,10 @@ (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)))) -- 2.39.2