From: Stefan Kangas Date: Wed, 16 Aug 2023 19:25:49 +0000 (+0200) Subject: Speed up dictionary--count-mode-buffers X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d96dd127e392d05c2753908661d27760cedd5d2d;p=emacs.git Speed up dictionary--count-mode-buffers * lisp/net/dictionary.el (dictionary--count-mode-buffers): Make faster. Patch by Visuwesh . --- diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index f4a381db75d..58f36db2523 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -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)