emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 25b4bf7fcd7: * lisp/tab-line.el (tab-line-tabs-fixed-window-buffe


From: Juri Linkov
Subject: master 25b4bf7fcd7: * lisp/tab-line.el (tab-line-tabs-fixed-window-buffers): More optimizations.
Date: Wed, 4 Dec 2024 13:39:17 -0500 (EST)

branch: master
commit 25b4bf7fcd75564f23b2e60e29e8ff7354186371
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-line.el (tab-line-tabs-fixed-window-buffers): More optimizations.
    
    Use :size arg of 'make-hash-table' as a hint how many buffers
    the table will have.  Add ':in-place t' to 'sort'.
---
 lisp/tab-line.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 3c83a02739a..3bf42431ac0 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -555,12 +555,15 @@ This means that switching to a buffer previously shown in 
the same
 window will keep the same order of tabs that was before switching.
 And newly displayed buffers are added to the end of the tab line."
   (let* ((old-buffers (window-parameter nil 'tab-line-buffers))
-         (buffer-positions (let ((index-table (make-hash-table :test 'eq)))
+         (buffer-positions (let ((index-table (make-hash-table
+                                               :size (length old-buffers)
+                                               :test #'eq)))
                              (seq-do-indexed
                               (lambda (buf idx) (puthash buf idx index-table))
                               old-buffers)
                              index-table))
          (new-buffers (sort (tab-line-tabs-window-buffers)
+                            :in-place t
                             :key (lambda (buffer)
                                    (gethash buffer buffer-positions
                                             most-positive-fixnum)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]