From: Stefan Kangas Date: Mon, 4 Sep 2023 16:24:31 +0000 (+0200) Subject: Use seq-count in three functions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0edf237b3d04635d71c46e8eca8a2a3563ac73ad;p=emacs.git Use seq-count in three functions * lisp/net/shr.el (shr-count): * lisp/progmodes/idlwave.el (idlwave-count-memq): Use seq-count. (idlwave-count-eq): Use seq-count. Make obsolete, as it is unused. --- diff --git a/lisp/net/shr.el b/lisp/net/shr.el index b5bb7b42650..e130eea2fbe 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -2617,12 +2617,10 @@ flags that control whether to collect or render objects." columns)) (defun shr-count (dom elem) - (let ((i 0)) - (dolist (sub (dom-children dom)) - (when (and (not (stringp sub)) - (eq (dom-tag sub) elem)) - (setq i (1+ i)))) - i)) + (seq-count (lambda (x) + (and (not (stringp sub)) + (eq (dom-tag sub) elem))) + (dom-children dom))) (defun shr-max-columns (dom) (let ((max 0) diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index 3c00046a26a..54c758c6a8a 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -8750,11 +8750,12 @@ This expects NAME TYPE IDLWAVE-TWIN-CLASS to be bound to the right values." (defun idlwave-count-eq (elt list) "How often is ELT in LIST?" - (length (delq nil (mapcar (lambda (x) (eq x elt)) list)))) + (declare (obsolete nil "30.1")) + (seq-count (lambda (x) (eq x elt)) list)) (defun idlwave-count-memq (elt alist) "How often is ELT a key in ALIST?" - (length (delq nil (mapcar (lambda (x) (eq (car x) elt)) alist)))) + (seq-count (lambda (x) (eq (car x) elt)) alist)) (defun idlwave-syslib-p (file) "Non-nil if FILE is in the system library."