Speed up dictionary--count-mode-buffers

* lisp/net/dictionary.el (dictionary--count-mode-buffers): Make
faster.  Patch by Visuwesh <visuweshm@gmail.com>.
This commit is contained in:
Stefan Kangas 2023-08-16 21:25:49 +02:00
parent cf5ae0507e
commit d96dd127e3

View file

@ -574,13 +574,13 @@ The connection takes the proxy setting in customization group
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun dictionary--count-mode-buffers ()
"Return the number of buffers that "
(seq-reduce #'+
(mapcar
(lambda (buf)
(with-current-buffer buf
(if (derived-mode-p 'dictionary-mode) 1 0)))
(buffer-list))
(seq-reduce (lambda (count buf)
(if (provided-mode-derived-p
(buffer-local-value 'major-mode buf)
'dictionary-mode)
(+ count 1)
count))
(buffer-list)
0))
(defun dictionary-close (&rest _ignored)