GNU bug report logs -
#68235
29.1.90; Switching tabs stops following process output in selected window
Previous Next
Reported by: Dan McCarthy <daniel.c.mccarthy <at> gmail.com>
Date: Wed, 3 Jan 2024 20:49:02 UTC
Severity: normal
Found in version 29.1.90
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> 1. 'post-set-window-configuration-functions' is called even
> after 'delete-other-windows' and 'kill-buffer', albeit with
> windows=nil, so no problems.
I don't understand what you mean here. Do you mean that it gets called
because for some reason 'set-window-configuration' gets called after
'delete-other-windows' and 'kill-buffer'?
> 2. It seems there is no way to get the name of the killed buffer
> from '(nth 1 quad)'?
No way. 'buffer-name' with a killed buffer as argument has to return
nil - too many functions may rely on that.
> Here is what I tried:
>
> (defun foo (frame windows)
> (while windows
> (let* ((quad (car windows))
> (window (car quad))
> (buffer (generate-new-buffer
> (format " *Old buffer %s*" (nth 1 quad)))))
> (with-current-buffer buffer
> (insert (format "Restore the original buffer named %s:\n"
> (nth 1 quad)))
> (insert-button
> "[Restore]"
> 'action
> (lambda (_button)
> (set-window-buffer window (find-file-noselect
> (buffer-file-name (nth 1 quad))))
> (set-window-point window (nth 3 quad))
> (set-window-start window (nth 2 quad) t)))
> (set-window-buffer window buffer)))
> (setq windows (cdr windows))))
>
> It inserts to the transient buffer this text without the real buffer name:
>
> Restore the original buffer named #<killed buffer>:
> [Restore]
I'd say Restore buffer from ... and use the file name here.
> But the button really restores the original buffer.
Because many functions with a buffer as argument like 'buffer-file-name'
don't check whether that buffer is live. You can find such functions by
looking for "decode_buffer (buffer)" in buffer.c. 'buffer-name' fails
because the name of the buffer _is_ reset to nil when the buffer is
killed. We could add a new field to the buffer structure and a function
say 'buffer-last-name' which would return the last name a buffer had
before it was renamed: nil for a new buffer, the old name before the
last 'rename-buffer' and the last buffer name for a dead buffer.
And always think about what to propose when a new buffer with the same
name has been created meanwhile.
> 3. It seems the buffer-local value of 'revert-buffer-function'
> is not preserved in the killed buffer?
'kill-buffer' calls reset_buffer_local_variables which scans the local
variables alist of the buffer and resets all values to their default
values. Giving the variable either a 'permanent-local' property or
binding the default value to the buffer local value around 'kill-buffer'
could work around that but I'd rather try to save this (and other buffer
local values) in a separate alist for buffers stored in a configuration.
martin
This bug report was last modified 1 year and 30 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.