diff options
| author | Juri Linkov | 2019-12-05 01:08:24 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-12-05 01:08:24 +0200 |
| commit | bd95d66ae97f3dcfe73b972de935e27e434e49be (patch) | |
| tree | 08122cdf5489d7781d2a2804e93002f0fd153e4b | |
| parent | f336ae77cc422d82ea2738238b68234bc4c40966 (diff) | |
| download | emacs-bd95d66ae97f3dcfe73b972de935e27e434e49be.tar.gz emacs-bd95d66ae97f3dcfe73b972de935e27e434e49be.zip | |
* 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.
| -rw-r--r-- | lisp/tab-line.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/tab-line.el b/lisp/tab-line.el index c98b1cfce61..d080da1867d 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el | |||
| @@ -415,11 +415,10 @@ variable `tab-line-tabs-function'." | |||
| 415 | next-buffers)))) | 415 | next-buffers)))) |
| 416 | 416 | ||
| 417 | 417 | ||
| 418 | (defun tab-line-format () | 418 | (defun tab-line-format-template (tabs) |
| 419 | "Template for displaying tab line for selected window." | 419 | "Template for displaying tab line for selected window." |
| 420 | (let* ((window (selected-window)) | 420 | (let* ((window (selected-window)) |
| 421 | (selected-buffer (window-buffer window)) | 421 | (selected-buffer (window-buffer window)) |
| 422 | (tabs (funcall tab-line-tabs-function)) | ||
| 423 | (separator (or tab-line-separator (if window-system " " "|"))) | 422 | (separator (or tab-line-separator (if window-system " " "|"))) |
| 424 | (hscroll (window-parameter nil 'tab-line-hscroll)) | 423 | (hscroll (window-parameter nil 'tab-line-hscroll)) |
| 425 | (strings | 424 | (strings |
| @@ -470,6 +469,14 @@ variable `tab-line-tabs-function'." | |||
| 470 | (list (concat separator (when tab-line-new-tab-choice | 469 | (list (concat separator (when tab-line-new-tab-choice |
| 471 | tab-line-new-button))))))) | 470 | tab-line-new-button))))))) |
| 472 | 471 | ||
| 472 | (defun tab-line-format () | ||
| 473 | "Template for displaying tab line for selected window." | ||
| 474 | (let ((tabs (funcall tab-line-tabs-function)) | ||
| 475 | (cache (window-parameter nil 'tab-line-cache))) | ||
| 476 | (or (and cache (equal (car cache) tabs) (cdr cache)) | ||
| 477 | (cdr (set-window-parameter nil 'tab-line-cache | ||
| 478 | (cons tabs (tab-line-format-template tabs))))))) | ||
| 479 | |||
| 473 | 480 | ||
| 474 | (defcustom tab-line-auto-hscroll t | 481 | (defcustom tab-line-auto-hscroll t |
| 475 | "Allow or disallow automatic horizontal scrolling of the tab line. | 482 | "Allow or disallow automatic horizontal scrolling of the tab line. |