; * lisp/tab-bar.el: Remaining renaming of "fixed-width" to "auto-width".

This commit is contained in:
Juri Linkov 2022-12-21 19:30:24 +02:00
parent d76d7a3beb
commit 98c16a8c88

View file

@ -1021,7 +1021,7 @@ This variable has effect only when `tab-bar-auto-width' is non-nil."
:initialize 'custom-initialize-default :initialize 'custom-initialize-default
:set (lambda (sym val) :set (lambda (sym val)
(set-default sym val) (set-default sym val)
(setq tab-bar--fixed-width-hash nil)) (setq tab-bar--auto-width-hash nil))
:group 'tab-bar :group 'tab-bar
:version "29.1") :version "29.1")
@ -1040,17 +1040,17 @@ tab bar might wrap to the second line when it shouldn't.")
tab-bar-tab-group-inactive) tab-bar-tab-group-inactive)
"Resize tabs only with these faces.") "Resize tabs only with these faces.")
(defvar tab-bar--fixed-width-hash nil (defvar tab-bar--auto-width-hash nil
"Memoization table for `tab-bar-auto-width'.") "Memoization table for `tab-bar-auto-width'.")
(defun tab-bar-auto-width (items) (defun tab-bar-auto-width (items)
"Return tab-bar items with resized tab names." "Return tab-bar items with resized tab names."
(unless tab-bar--fixed-width-hash (unless tab-bar--auto-width-hash
(define-hash-table-test 'tab-bar--fixed-width-hash-test (define-hash-table-test 'tab-bar--auto-width-hash-test
#'equal-including-properties #'equal-including-properties
#'sxhash-equal-including-properties) #'sxhash-equal-including-properties)
(setq tab-bar--fixed-width-hash (setq tab-bar--auto-width-hash
(make-hash-table :test 'tab-bar--fixed-width-hash-test))) (make-hash-table :test 'tab-bar--auto-width-hash-test)))
(let ((tabs nil) ;; list of resizable tabs (let ((tabs nil) ;; list of resizable tabs
(non-tabs "") ;; concatenated names of non-resizable tabs (non-tabs "") ;; concatenated names of non-resizable tabs
(width 0)) ;; resize tab names to this width (width 0)) ;; resize tab names to this width
@ -1078,7 +1078,7 @@ tab bar might wrap to the second line when it shouldn't.")
(setf (nth 2 item) (setf (nth 2 item)
(with-memoization (gethash (list (selected-frame) (with-memoization (gethash (list (selected-frame)
width (nth 2 item)) width (nth 2 item))
tab-bar--fixed-width-hash) tab-bar--auto-width-hash)
(let* ((name (nth 2 item)) (let* ((name (nth 2 item))
(len (length name)) (len (length name))
(close-p (get-text-property (1- len) 'close-tab name)) (close-p (get-text-property (1- len) 'close-tab name))