next-buffers))))
\f
-(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
(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)))))))
+
\f
(defcustom tab-line-auto-hscroll t
"Allow or disallow automatic horizontal scrolling of the tab line.