1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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.
This commit is contained in:
Stefan Kangas 2023-09-04 18:24:31 +02:00
parent 7975c811d3
commit 0edf237b3d
2 changed files with 7 additions and 8 deletions

View file

@ -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)

View file

@ -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."