aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold Noronha2020-05-29 02:35:58 +0300
committerDmitry Gutov2020-05-29 02:35:58 +0300
commitdf4991093b94ccc48255a0387a98c536962fd0a7 (patch)
tree1282e3f1bcf484aea8626ac3d3135b2121671ba1
parent7865820f6b04486f4408fce30c2266379b0d59e8 (diff)
downloademacs-df4991093b94ccc48255a0387a98c536962fd0a7.tar.gz
emacs-df4991093b94ccc48255a0387a98c536962fd0a7.zip
Create a buffer-local binding to improve performance
* lisp/ido.el (ido-make-buffer-list-1): Create a buffer-local binding to improve performance when a lot of buffers are open (bug#41029). Copyright-paperwork-exempt: yes
-rw-r--r--lisp/ido.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 4fb01c68dfa..e834916a6da 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3410,13 +3410,18 @@ instead removed from the current item list."
3410 3410
3411(defun ido-make-buffer-list-1 (&optional frame visible) 3411(defun ido-make-buffer-list-1 (&optional frame visible)
3412 "Return list of non-ignored buffer names." 3412 "Return list of non-ignored buffer names."
3413 (delq nil 3413 (with-temp-buffer
3414 (mapcar 3414 ;; Each call to ido-ignore-item-p LET-binds case-fold-search.
3415 (lambda (x) 3415 ;; That is slow if there's no buffer-local binding available,
3416 (let ((name (buffer-name x))) 3416 ;; roughly O(number of buffers). This hack avoids it.
3417 (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) 3417 (setq-local case-fold-search nil)
3418 name))) 3418 (delq nil
3419 (buffer-list frame)))) 3419 (mapcar
3420 (lambda (x)
3421 (let ((name (buffer-name x)))
3422 (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible)))
3423 name)))
3424 (buffer-list frame)))))
3420 3425
3421(defun ido-make-buffer-list (default) 3426(defun ido-make-buffer-list (default)
3422 "Return the current list of buffers. 3427 "Return the current list of buffers.