(defvar tab-line-auto-hscroll)
+(defun tab-line-cache-key-default (_tabs)
+ "Return default list of cache keys."
+ (list
+ ;; for setting face 'tab-line-tab-current'
+ (mode-line-window-selected-p)
+ ;; for `tab-line-tab-face-modified'
+ (and (memq 'tab-line-tab-face-modified
+ tab-line-tab-face-functions)
+ (buffer-file-name)
+ (buffer-modified-p))))
+
+(defvar tab-line-cache-key-function #'tab-line-cache-key-default
+ "Function that adds more cache keys.
+It has one argument with a list of tabs, and returns a list of cache keys.
+You can use `add-function' to add more cache keys.")
+
(defun tab-line-format ()
"Format for displaying the tab line of the selected window."
(let* ((tabs (funcall tab-line-tabs-function))
- (cache-key (list tabs
- ;; handle buffer renames
- (buffer-name (window-buffer))
- ;; handle tab-line scrolling
- (window-parameter nil 'tab-line-hscroll)
- ;; for setting face 'tab-line-tab-current'
- (mode-line-window-selected-p)
- (and (memq 'tab-line-tab-face-modified
- tab-line-tab-face-functions)
- (buffer-file-name) (buffer-modified-p))))
+ (cache-key (append (list tabs
+ ;; handle buffer renames
+ (buffer-name (window-buffer))
+ ;; handle tab-line scrolling
+ (window-parameter nil 'tab-line-hscroll))
+ (funcall tab-line-cache-key-function tabs)))
(cache (window-parameter nil 'tab-line-cache)))
;; Enable auto-hscroll again after it was disabled on manual scrolling.
;; The moment to enable it is when the window-buffer was updated.