]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/tab-line.el (tab-line-mode): Preserve existing value of tab-line-format
authorJuri Linkov <juri@linkov.net>
Sun, 14 Nov 2021 18:35:42 +0000 (20:35 +0200)
committerJuri Linkov <juri@linkov.net>
Sun, 14 Nov 2021 18:35:42 +0000 (20:35 +0200)
Keep the old value of tab-line-format when enabling tab-line-mode
and don't overwrite it with nil when disabling tab-line-mode (bug#51830).

lisp/tab-line.el

index 5affae79138dfc50ffe68cf02f17426c57bddaa5..110c6e96969b63f2048bedad6da7e8f126958001 100644 (file)
@@ -893,7 +893,14 @@ sight of the tab line."
 (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)