[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51830: 29.0.50; tab-line-mode will override (setq-default tab-line-f
From: |
Juri Linkov |
Subject: |
bug#51830: 29.0.50; tab-line-mode will override (setq-default tab-line-format "xxx") |
Date: |
Sun, 14 Nov 2021 19:40:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> (setq tab-line-format "xxx")
>> (global-tab-line-mode 1)
>>
>> value "xxx" will lost.
>
> Yes, tab-line-mode resets the variable unconditionally:
>
> (define-minor-mode tab-line-mode
> "Toggle display of tab line in the windows displaying the current buffer."
> :lighter nil
> (setq tab-line-format (when tab-line-mode '(:eval (tab-line-format)))))
>
> Perhaps that should be done only when the variable's value is nil?
This needs also to keep the original value while disabling the mode.
Do you think this should be installed in Emacs 28?
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 5affae7913..110c6e9696 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -893,7 +893,14 @@ tab-line-context-menu
(define-minor-mode tab-line-mode
"Toggle display of tab line in the windows displaying the current buffer."
:lighter nil
- (setq tab-line-format (when tab-line-mode '(:eval (tab-line-format)))))
+ (let ((default-value '(:eval (tab-line-format))))
+ (if tab-line-mode
+ ;; Preserve the existing tab-line set outside of this mode
+ (unless tab-line-format
+ (setq tab-line-format default-value))
+ ;; Reset only values set by this mode
+ (when (equal tab-line-format default-value)
+ (setq tab-line-format nil)))))
(defcustom tab-line-exclude-modes
'(completion-list-mode)