From: Juri Linkov Date: Sun, 6 Nov 2022 07:37:12 +0000 (+0200) Subject: * lisp/tab-bar.el (tab-bar-fixed-width-max): Change :type from cons to list. X-Git-Tag: emacs-29.0.90~1616^2~270 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=69a55568bfeaeb1cb9ad683453bfbc9397cef40b;p=emacs.git * lisp/tab-bar.el (tab-bar-fixed-width-max): Change :type from cons to list. This will allow possible future extensions to customize Double (HiDPI). (tab-bar-fixed-width-min): Change :type from cons to list. (tab-bar-fixed-width): Use the list instead of cons. --- diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 2150fa15065..16763132fe8 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -985,21 +985,25 @@ The maximum tab width is defined by the variable `tab-bar-fixed-width-max'." :group 'tab-bar :version "29.1") -(defcustom tab-bar-fixed-width-max '(220 . 20) +(defcustom tab-bar-fixed-width-max '(220 20) "Maximum number of pixels or characters allowed for the tab name width. -The car of the cons cell is the maximum number of pixels when used on -a GUI session. The cdr of the cons cell defines the maximum number of -characters when used on a tty. When set to nil, there is no limit +The first element of the list is the maximum number of pixels when used on +a GUI session. The second element of the list defines the maximum number +of characters when used on a tty. When set to nil, there is no limit on maximum width, and tabs are resized evenly to the whole width of the tab bar when `tab-bar-fixed-width' is non-nil." :type '(choice (const :tag "No limit" nil) - (cons (integer :tag "Max width (pixels)" :value 220) + (list (integer :tag "Max width (pixels)" :value 220) (integer :tag "Max width (chars)" :value 20))) + :initialize 'custom-initialize-default + :set (lambda (sym val) + (set-default sym val) + (setq tab-bar--fixed-width-hash nil)) :group 'tab-bar :version "29.1") -(defvar tab-bar-fixed-width-min '(20 . 2) +(defvar tab-bar-fixed-width-min '(20 2) "Minimum number of pixels or characters allowed for the tab name width. It's not recommended to change this value since with a bigger value, the tab bar might wrap to the second line.") @@ -1038,12 +1042,12 @@ tab bar might wrap to the second line.") (length tabs))) (when tab-bar-fixed-width-min (setq width (max width (if window-system - (car tab-bar-fixed-width-min) - (cdr tab-bar-fixed-width-min))))) + (nth 0 tab-bar-fixed-width-min) + (nth 1 tab-bar-fixed-width-min))))) (when tab-bar-fixed-width-max (setq width (min width (if window-system - (car tab-bar-fixed-width-max) - (cdr tab-bar-fixed-width-max))))) + (nth 0 tab-bar-fixed-width-max) + (nth 1 tab-bar-fixed-width-max))))) (dolist (item tabs) (setf (nth 2 item) (with-memoization (gethash (cons width (nth 2 item))