unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71779: 30.0.60; tab-bar-select-restore-windows: docstring vs default value
@ 2024-06-26  6:44 Kévin Le Gouguec
  2024-06-27 16:59 ` Juri Linkov
  0 siblings, 1 reply; 3+ messages in thread
From: Kévin Le Gouguec @ 2024-06-26  6:44 UTC (permalink / raw)
  To: 71779; +Cc: Juri Linkov

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

Heya!

Intrigued by tab-bar-select-restore-windows's docstring:

> Function called when selecting a tab to handle windows whose buffer was killed.
> When a tab-bar tab displays a window whose buffer was killed since
> this tab was last selected, this function determines what to do with
> that window.  By default, either a random buffer is displayed instead of
                ^^^^^^^^^^
> the killed buffer, or the window gets deleted.  However, with the help
> of ‘window-restore-killed-buffer-windows’ it’s possible to handle such
> situations better by displaying an information about the killed buffer.

Over here, 'emacs -Q' suggests that _by default_, this option is set to
the eponymous symbol 'tab-bar-select-restore-windows'.  So the default
behaviour that I observe, when coming back to a tab that used to show a
killed buffer, is a special-mode buffer named " *Old buffer foo*" saying
"This window displayed the buffer ‘foo’."

Based on the NEWS entry, I guess the effective default behaviour is the
one intended?  In which case, I'm attaching a suggested rewording of the
docstring, based on understanding gleaned from cross-referencing the
NEWS entry, the docstrings for set-window-configuration,
window-restore-killed-buffer-windows, the corresponding manual entries,
and the source for set-window-configuration.

I am not 100% sure I succeeded in capturing the state of things, so feel
free to dismiss the patch; my main goal was to make it easier for Past
Me to get an answer to the question: "How do I get the previous
behaviour back"?

(Rationale FWIW: IME killing buffers is deliberate, so the placeholder
buffer feels redundant, i.e. it brings no information; if I am
displeased with whatever random buffer was picked to show in that
window, I can just switch to another buffer or delete the window)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1424 bytes --]

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 3401b796cac..58d2ef650a1 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1456,10 +1456,18 @@ tab-bar-select-restore-windows
   "Function called when selecting a tab to handle windows whose buffer was killed.
 When a tab-bar tab displays a window whose buffer was killed since
 this tab was last selected, this function determines what to do with
-that window.  By default, either a random buffer is displayed instead of
-the killed buffer, or the window gets deleted.  However, with the help
-of `window-restore-killed-buffer-windows' it's possible to handle such
-situations better by displaying an information about the killed buffer."
+that window.  By default, a placeholder buffer is displayed in that
+window to give the user information about the killed buffer; this
+option can also be set to:
+
+ * nil:        no special handling; `set-window-configuration' will
+               decide what to do with the window, e.g. make it display
+               another buffer;
+
+ * a function: display another buffer in that window, and pass that
+               buffer to the function.  See
+               `window-restore-killed-buffer-windows' for the calling
+               convention."
   :type '(choice (const :tag "No special handling" nil)
                  (const :tag "Show placeholder buffers"
                         tab-bar-select-restore-windows)

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#71779: 30.0.60; tab-bar-select-restore-windows: docstring vs default value
  2024-06-26  6:44 bug#71779: 30.0.60; tab-bar-select-restore-windows: docstring vs default value Kévin Le Gouguec
@ 2024-06-27 16:59 ` Juri Linkov
  2024-06-29  9:13   ` Kévin Le Gouguec
  0 siblings, 1 reply; 3+ messages in thread
From: Juri Linkov @ 2024-06-27 16:59 UTC (permalink / raw)
  To: Kévin Le Gouguec; +Cc: 71779

close 71779 30.0.60
thanks

> I am not 100% sure I succeeded in capturing the state of things, so feel
> free to dismiss the patch; my main goal was to make it easier for Past
> Me to get an answer to the question: "How do I get the previous
> behaviour back"?

Thanks, I adapted your suggestion for the docstring.

> (Rationale FWIW: IME killing buffers is deliberate, so the placeholder
> buffer feels redundant, i.e. it brings no information; if I am
> displeased with whatever random buffer was picked to show in that
> window, I can just switch to another buffer or delete the window)

Actually, it's not about displeasing, it's about confusion.
For example, a user has a tab with the name "NEWS", switches
to another tab and kills the buffer, then quits Emacs,
and the next day opens the tab "NEWS", and it displays
a random buffer, e.g. "TODO".  So the user asks: "Why?"
With this option the answer in the same window.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#71779: 30.0.60; tab-bar-select-restore-windows: docstring vs default value
  2024-06-27 16:59 ` Juri Linkov
@ 2024-06-29  9:13   ` Kévin Le Gouguec
  0 siblings, 0 replies; 3+ messages in thread
From: Kévin Le Gouguec @ 2024-06-29  9:13 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 71779

Juri Linkov <juri@linkov.net> writes:

>> I am not 100% sure I succeeded in capturing the state of things, so feel
>> free to dismiss the patch; my main goal was to make it easier for Past
>> Me to get an answer to the question: "How do I get the previous
>> behaviour back"?
>
> Thanks, I adapted your suggestion for the docstring.

Looks good to me, thanks 🙏





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-29  9:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-26  6:44 bug#71779: 30.0.60; tab-bar-select-restore-windows: docstring vs default value Kévin Le Gouguec
2024-06-27 16:59 ` Juri Linkov
2024-06-29  9:13   ` Kévin Le Gouguec

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).