summaryrefslogtreecommitdiff
path: root/lisp/tab-line.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-12-09 00:08:53 +0200
committerJuri Linkov <juri@linkov.net>2019-12-09 00:08:53 +0200
commitfe7ae74c0b0b40dff4af8fa46da8f5f537bb99a0 (patch)
tree8d7e791dd80dc5eb5a3c3b9b651f7458caac2333 /lisp/tab-line.el
parent37d801a19aa0d49312445ec0f2b21f8f44a37bb7 (diff)
downloademacs-fe7ae74c0b0b40dff4af8fa46da8f5f537bb99a0.tar.gz
* lisp/tab-line.el (tab-line-format): Use composite cache key (bug#38522)
Diffstat (limited to 'lisp/tab-line.el')
-rw-r--r--lisp/tab-line.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index d080da1867d..914cf13246a 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -417,8 +417,7 @@ variable `tab-line-tabs-function'."
(defun tab-line-format-template (tabs)
"Template for displaying tab line for selected window."
- (let* ((window (selected-window))
- (selected-buffer (window-buffer window))
+ (let* ((selected-buffer (window-buffer))
(separator (or tab-line-separator (if window-system " " "|")))
(hscroll (window-parameter nil 'tab-line-hscroll))
(strings
@@ -471,11 +470,15 @@ variable `tab-line-tabs-function'."
(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)))))))
+ (let* ((tabs (funcall tab-line-tabs-function))
+ (cache-key (list tabs
+ (window-buffer)
+ (window-parameter nil 'tab-line-hscroll)))
+ (cache (window-parameter nil 'tab-line-cache)))
+ (or (and cache (equal (car cache) cache-key) (cdr cache))
+ (cdr (set-window-parameter
+ nil 'tab-line-cache
+ (cons cache-key (tab-line-format-template tabs)))))))
(defcustom tab-line-auto-hscroll t