all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 51830@debbugs.gnu.org, Feng Shu <tumashu@163.com>
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	[thread overview]
Message-ID: <8635nyzldf.fsf@mail.linkov.net> (raw)
In-Reply-To: <871r3jb60v.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 14 Nov 2021 07:33:36 +0100")

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

>> (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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tab-line-mode.patch --]
[-- Type: text/x-diff, Size: 803 bytes --]

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)

  reply	other threads:[~2021-11-14 17:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14  6:05 bug#51830: 29.0.50; tab-line-mode will override (setq-default tab-line-format "xxx") Feng Shu
2021-11-14  6:33 ` Lars Ingebrigtsen
2021-11-14 17:40   ` Juri Linkov [this message]
2021-11-14 17:45     ` Lars Ingebrigtsen
2021-11-14 17:46     ` Eli Zaretskii
2021-11-14 18:36     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8635nyzldf.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=51830@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=tumashu@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.