diff options
| -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. |