diff options
| author | Juri Linkov | 2024-08-19 19:56:31 +0300 |
|---|---|---|
| committer | Juri Linkov | 2024-08-19 19:56:31 +0300 |
| commit | 60da504cf7ca2c95ab4e3bea10875271b15a5a45 (patch) | |
| tree | a18c6dddf8f5cdf364b899035f2368205857e9a7 | |
| parent | 9ed761a793f0f11ffea1d2cfa9b7ff38a58d3fe1 (diff) | |
| download | emacs-60da504cf7ca2c95ab4e3bea10875271b15a5a45.tar.gz emacs-60da504cf7ca2c95ab4e3bea10875271b15a5a45.zip | |
* lisp/tab-bar.el: Improve tab-bar-auto-width-predicate-default (bug#71883).
(tab-bar--auto-width-faces-default): New variable with the
value from the default value of tab-bar-auto-width-faces.
(tab-bar-auto-width-faces): Set the default value to
tab-bar--auto-width-faces-default.
(tab-bar-auto-width-predicate-default): For backwards-compatibility
use the old logic of checking tab-bar-auto-width-faces when its value
was changed. Otherwise, check for a symbol, but remove "current-group"
from the list of symbols.
| -rw-r--r-- | lisp/tab-bar.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 6133915b591..734058175cf 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el | |||
| @@ -1238,18 +1238,24 @@ which see. | |||
| 1238 | It's not recommended to change this value since with larger values, the | 1238 | It's not recommended to change this value since with larger values, the |
| 1239 | tab bar might wrap to the second line when it shouldn't.") | 1239 | tab bar might wrap to the second line when it shouldn't.") |
| 1240 | 1240 | ||
| 1241 | (defvar tab-bar-auto-width-faces | 1241 | (defconst tab-bar--auto-width-faces-default |
| 1242 | '( tab-bar-tab tab-bar-tab-inactive | 1242 | '( tab-bar-tab tab-bar-tab-inactive |
| 1243 | tab-bar-tab-ungrouped | 1243 | tab-bar-tab-ungrouped |
| 1244 | tab-bar-tab-group-inactive) | 1244 | tab-bar-tab-group-inactive)) |
| 1245 | |||
| 1246 | (defvar tab-bar-auto-width-faces | ||
| 1247 | tab-bar--auto-width-faces-default | ||
| 1245 | "Resize tabs only with these faces.") | 1248 | "Resize tabs only with these faces.") |
| 1246 | 1249 | ||
| 1247 | (defun tab-bar-auto-width-predicate-default (item) | 1250 | (defun tab-bar-auto-width-predicate-default (item) |
| 1248 | "Accepts tab ITEM and returns non-nil for tabs and tab groups." | 1251 | "Accepts tab ITEM and returns non-nil for tabs and tab groups." |
| 1249 | (string-match-p | 1252 | (if (eq tab-bar-auto-width-faces tab-bar--auto-width-faces-default) |
| 1250 | ;; (rx bos (or "current-tab" "current-group" "tab-" "group-")) | 1253 | (string-match-p |
| 1251 | "\\`\\(?:current-\\(?:group\\|tab\\)\\|\\(?:group\\|tab\\)-\\)" | 1254 | ;; (rx bos (or "current-tab" "tab-" "group-")) |
| 1252 | (symbol-name (nth 0 item)))) | 1255 | "\\`\\(?:current-tab\\|\\(?:group\\|tab\\)-\\)" |
| 1256 | (symbol-name (nth 0 item))) | ||
| 1257 | (memq (get-text-property 0 'face (nth 2 item)) | ||
| 1258 | tab-bar-auto-width-faces))) | ||
| 1253 | 1259 | ||
| 1254 | (defvar tab-bar-auto-width-functions '(tab-bar-auto-width-predicate-default) | 1260 | (defvar tab-bar-auto-width-functions '(tab-bar-auto-width-predicate-default) |
| 1255 | "List of functions for `tab-bar-auto-width' to call with a tab ITEM. | 1261 | "List of functions for `tab-bar-auto-width' to call with a tab ITEM. |