[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bd95d66: * lisp/tab-line.el: Cache the tab-line-format template.
From: |
Juri Linkov |
Subject: |
master bd95d66: * lisp/tab-line.el: Cache the tab-line-format template. |
Date: |
Wed, 4 Dec 2019 18:08:31 -0500 (EST) |
branch: master
commit bd95d66ae97f3dcfe73b972de935e27e434e49be
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* lisp/tab-line.el: Cache the tab-line-format template.
(tab-line-format): Cache the result of tab-line-format-template in window.
(tab-line-format-template): New function that returns the value to cache.
---
lisp/tab-line.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index c98b1cf..d080da1 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -415,11 +415,10 @@ variable `tab-line-tabs-function'."
next-buffers))))
-(defun tab-line-format ()
+(defun tab-line-format-template (tabs)
"Template for displaying tab line for selected window."
(let* ((window (selected-window))
(selected-buffer (window-buffer window))
- (tabs (funcall tab-line-tabs-function))
(separator (or tab-line-separator (if window-system " " "|")))
(hscroll (window-parameter nil 'tab-line-hscroll))
(strings
@@ -470,6 +469,14 @@ variable `tab-line-tabs-function'."
(list (concat separator (when tab-line-new-tab-choice
tab-line-new-button)))))))
+(defun tab-line-format ()
+ "Template for displaying tab line for selected window."
+ (let ((tabs (funcall tab-line-tabs-function))
+ (cache (window-parameter nil 'tab-line-cache)))
+ (or (and cache (equal (car cache) tabs) (cdr cache))
+ (cdr (set-window-parameter nil 'tab-line-cache
+ (cons tabs (tab-line-format-template tabs)))))))
+
(defcustom tab-line-auto-hscroll t
"Allow or disallow automatic horizontal scrolling of the tab line.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master bd95d66: * lisp/tab-line.el: Cache the tab-line-format template.,
Juri Linkov <=