If 'window-state-normalize-buffer-name' is non-nil, 'window-state-get'
will normalize stored buffer names, making them easier to restore for
users that use 'uniquify' buffer naming.
* doc/lispref/windows.texi (Window Configurations): Document
'window-state-normalize-buffer-name'.
* lisp/window.el (window-state-normalize-buffer-name): New defvar.
(window--state-normalize-buffer-name): New function.
(window--state-get-1): Call 'window--state-normalize-buffer-name'
rather than 'buffer-name'.
* etc/NEWS: Announce 'window-state-normalize-buffer-name'.
(Bug#76980)
* lisp/window.el (window-indirect-buffer-p): New function.
(get-buffer-window-list): New argument INDIRECT.
(display-buffer-reuse-window): New alist entry 'reuse-indirect'
to reuse a window indirectly related to the BUFFER argument.
* doc/lispref/windows.texi (Buffers and Windows): Describe new
function 'window-indirect-buffer-p' and new argument INDIRECT of
'get-buffer-window-list'.
(Buffer Display Action Functions): Describe new action alist
entry 'reuse-indirect'.
* etc/NEWS: Announce new argument for 'get-buffer-window-list' and
new 'display-buffer' action alist entry 'reuse-indirect'.
* doc/lispref/windows.texi (Changing Window Layouts): New section
to document the new functions for changing window layouts.
* doc/lispref/elisp.texi (Top): Add entry for new section.
* src/window.c (Fwindow_old_buffer): Handle deleted window as
argument.
(make_parent_window): Remove function.
(Fsplit_window_internal): New argument REFER for resurrecting
deleted windows. Incorporate functionality of defunct
make_parent_window.
(Fdelete_window_internal, delete_all_child_windows): Store any
deleted window's buffer in the window's old_buffer slot.
(window_dead_windows_table): Make it a 'value' type hash table
so the sequence number cannot affect its weakness.
* lisp/window.el (split-window): New argument REFER.
* doc/lispref/windows.texi (Resurrecting Windows): New section.
(Splitting Windows): Explain new argument REFER.
(Window Hooks): Rewrite description of 'window-old-buffer'.
* etc/NEWS: Mention new REFER argument for 'split-window'.
* lisp/window.el (fit-frame-to-buffer-1): When
'frame-resize-pixelwise' is nil, round up requested sizes to avoid
that lines get wrapped (Bug#74866).
* doc/lispref/windows.texi (Resizing Windows): Mention that with
size hints one may have to set 'frame-resize-pixelwise' to make
'fit-frame-to-buffer' fit the buffer exactly.
d953179320 Make 'jsonrpc-default-request-timeout' a defcustom
5339c6f69e ; Improve example of display-buffer-alist category in ELi...
e14007ad63 Update MS-Windows build instructions
# Conflicts:
# etc/NEWS
* doc/lispref/windows.texi (Choosing Window): Use 'add-to-list'
and add an example how to override display-buffer-alist entries
such as 'inhibit-same-window' by matching the window
using the 'category' condition (bug#74457).
74a972cace Skip proced refine tests on Darwin
c50ce03afc ; Fix recent additions to the manuals
c818c5bbaf ; * lisp/term/w32-win.el (tree-sitter--library-abi): Decl...
b71d3b2f52 ; Better clarify function types in C-h f (bug#73626)
59b3eae481 ; Introduce type specifiers to the elisp manual (bug#73626)
83fc3cf53a Future-proof loading tree-sitter library on MS-Windows
3eb3018682 ; Improve documentation of 'category' in display-buffer a...
4d80c4f485 ; More accurate documentation of 'set-mark-command'
70dd5705e1 Fix overriding 'c-ts-mode' by 'c-mode'
331610aef0 ; Improve vc-dir help-echo
9c484d5101 ; Avoid assertion violations in "temacs -Q"
8dc9dfdc38 lisp/progmodes/c-ts-mode.el: Demote loading c-ts-mode as ...
426bce8a67 ; In PROBLEMS mention issue with .Xresources on Gnome des...
* lisp/window.el (window-no-other-p): New function.
(window-in-direction, get-lru-window, get-mru-window)
(get-largest-window, other-window, window-at-x-y)
(delete-window-choose-selected, delete-window): Use it to check
whether 'ignore-window-parameters' should inhibit processing the
'no-other-window' parameter (Bug#73706).
* lisp/erc/erc-speedbar.el
(erc-speedbar-toggle-nicknames-window-lock): Use
'window-no-other-p'.
* doc/lispref/windows.texi (Windows and Frames)
(Deleting Windows, Cyclic Window Ordering): Describe new
function 'window-no-other-p' and use it in description of
functions that call it.
(Window Parameters): Add cross references for 'no-other-window'
parameter.
* src/minibuf.c (zip_minibuffer_stacks): Use wset type
functions. Call 'record-window-buffer' instead of
'push-window-buffer-onto-prev' to handle all sorts of buffers
shown in minibuffer windows in a uniform way.
(read_minibuf): Call 'record-window-buffer' instead of
'push-window-buffer-onto-prev' for same reason as previous.
* lisp/calculator.el (calculator-update-display)
(calculator-save-and-quit): Make sure calculator buffer is live
before operating on it.
* lisp/window.el (record-window-buffer): Handle case where
WINDOW is a minibuffer window: Unconditionally remove WINDOW's
buffer from WINDOW's list of previous buffers and push it if
and only if it is a live minibuffer (Bug#72487). Do not run
'buffer-list-update-hook' if WINDOW is a minibuffer window.
(push-window-buffer-onto-prev): Make it an alias of
'record-window-buffer' so it will run the latter's checks.
(replace-buffer-in-windows): Handle minibuffer windows and
rewrite doc-string accordingly.
* doc/lispref/windows.texi (Buffers and Windows): Explain
handling of minibuffer windows in 'replace-buffer-in-windows'.
The purpose of these changes is to improve the code handling the
display of buffers in windows, switching to previous and next
buffers in windows and restoring a previous state after quitting
or killing buffers. In particular it does:
- Add a new window parameter 'quit-restore-prev' so a window can
keep its initial 'quit-restore' parameter and undoing a sequence
of quit window operations becomes more reliable (Bug#59862).
- Optionally have 'kill-buffer' call 'quit-restore-window' for
all windows showing the argument buffer (Bug#59862).
- Add a new hook so it's possible to avoid that a window gets
deleted implicitly by functions like 'kill-buffer' (Bug#71386).
- Add a new option to make 'quit-restore-window' delete windows
more aggressively (Bug#59862).
- Immediately remove killed buffers from all windows' previous
and next buffers. For windows that are already dead, use a weak
hash table to be used by 'kill-buffer'. This avoids any special
handling of such windows by the garbage collector.
- Immediately remove 'quit-restore' and 'quit-restore-prev'
window parameters that reference killed buffers. These
parameters have no more use once their buffers got killed.
- Make sure that internal windows do not have any previous and
next buffers. This fixes a silly memory leak.
- Make sure that after set_window_buffer and some wset_buffer
calls the buffer now shown in the window does not appear in the
lists of that window's previous and next buffers. The old
behavior could make functions investigating these lists
erroneously believe that there still existed some other buffer
to switch to.
* src/alloc.c (mark_discard_killed_buffers): Remove function.
(mark_window): No more filter previous and next buffer lists.
* src/window.h (struct window): Move up prev_buffers and
next-buffers in structure; they are now treated by the collector
as usual.
* src/window.c (window_discard_buffer_from_alist)
(window_discard_buffer_from_list)
(window_discard_buffer_from_window)
(window_discard_buffer_from_dead_windows)
(Fwindow_discard_buffer): New functions.
(set_window_buffer): Discard BUFFER from WINDOW's previous and
next buffers.
(make_parent_window): Make sure internal windows have no previous
and next buffers.
(make_window): Don't initialize window's previous and next
buffers, they are handled by allocate_window now.
(Fdelete_window_internal): Add WINDOW to window_dead_windows_table.
(Fset_window_configuration): Remove resurrected window from
window_dead_windows_table. Make sure buffers set by wset_buffer
calls are not recorded in window's previous and next buffers.
(delete_all_child_windows): Add deleted windows to
window_dead_windows_table.
(window_dead_windows_table): New weak hash table to record dead
windows that are stored in saved window configurations.
* src/buffer.c (Fkill_buffer): Call new function
'window_discard_buffer_from_dead_windows'.
* lisp/window.el (window-deletable-functions): New hook.
(window-deletable-p): Update doc-string. Run
'window-deletable-functions' (Bug#71386).
(unrecord-window-buffer): New argument ALL. Move body to
'window-discard-buffer-from-window' so that if ALL is non-nil,
WINDOW's 'quit-restore' and 'quit-restore-prev' parameters get
removed too.
(switch-to-prev-buffer): Don't care about killed buffers here;
'replace-buffer-in-windows' should have done that already. Use
'unrecord-window-buffer'.
(switch-to-next-buffer): Don't care about killed buffers here;
'replace-buffer-in-windows' should do that now.
(kill-buffer-quit-windows): New option.
(delete-windows-on): Update doc-string. Handle new option
'kill-buffer-quit-windows'. Update 'unrecord-window-buffer'
calls.
(replace-buffer-in-windows): Update doc-string. Handle new
option 'kill-buffer-quit-windows' (Bug#59862). Update call to
'unrecord-window-buffer'.
(quit-restore-window-no-switch): New option.
(quit-restore-window): Update doc-string. Handle additional
values of BURY-OR-KILL so to not kill a buffer about to be
killed by the caller. Handle 'quit-restore-prev' parameter
(Bug#59862). Handle new option 'quit-restore-window-no-switch'
(Bug#59862).
(quit-windows-on): Update doc-string. Call 'quit-window-hook'
and call 'quit-restore-window' directly so that the buffer does
not get buried or killed by the latter. Update
'unrecord-window-buffer' call.
(display-buffer-record-window): Update doc-string. Handle new
`quit-restore-prev' parameter (Bug#59862).
(switch-to-buffer): Call 'display-buffer-record-window' so a
latter 'quit-restore-window' can use its parameters.
* doc/lispref/windows.texi (Deleting Windows): Describe implicit
deletion of windows and new hook 'window-deletable-functions'.
(Buffers and Windows): Update description of
'replace-buffer-in-windows'. Describe new option
'kill-buffer-quit-windows'.
(Quitting Windows): Describe 'quit-restore-prev' parameter and
new option 'quit-restore-window-no-switch'. Update description
of 'quit-restore-window'.
(Window Parameters): Mention 'quit-restore-prev' parameter.
* etc/NEWS: Add entries for 'window-deletable-functions',
'kill-buffer-quit-windows', 'quit-restore-window-no-switch'.
mention new parameter 'quit-restore-prev' and new argument
values for 'quit-restore-window'.
* doc/lispref/commands.texi (Focus Events): Add
documentation for the structure of 'switch-window' events.
Make sure to be clear when referring to window system windows
vs Emacs windows.
* doc/lispref/windows.texi (Mouse Window Auto-selection):
Adding cross-reference to "Focus Events". (Bug#69915)
* doc/lispref/windows.texi (Choosing Window): Provide an example
of using '(category . comint)' in the condition of 'display-buffer-alist'
and in the action of 'display-buffer'.
(Buffer Display Action Alists): Add a new action alist entry 'category'.
* lisp/subr.el (buffer-match-p): Add a new condition 'category'.
* lisp/window.el (display-buffer): Document a new action alist entry
'category'.
Suggested by Michael Heerdegen <michael_heerdegen@web.de>.
* src/window.c (window_restore_killed_buffer_windows): In
doc-string write 'symbol' instead of 'constant'.
* lisp/window.el (display-buffer--lru-window)
(display-buffer-use-least-recent-window): In doc-strings write
'symbol' instead of 'constant'.
* doc/lispref/windows.texi (Window Configurations): Write
'symbol' instead of 'constant'.
* etc/NEWS: Announce 'window-restore-killed-buffer-windows'.
* src/buffer.h (struct buffer) : New field last_name_.
* src/buffer.c (Fbuffer_last_name): New function to return last
name of buffer before it was killed or renamed.
(bset_last_name, Fget_buffer_create, Fmake_indirect_buffer)
(Frename_buffer, Fkill_buffer, init_buffer_once): Set buffer's
last_name_ field accordingly.
* src/window.c (window_restore_killed_buffer_windows): New
variable replacing Vwindow_kept_windows_functions.
(Fset_window_configuration): Use
window_restore_killed_buffer_windows instead of
Vwindow_kept_windows_functions.
* lisp/window.el (window--state-put-2, window-state-put): Use
'window-restore-killed-buffer-windows' instead of
'window-kept-windows-functions'.
* doc/lispref/windows.texi (Window Configurations): Describe
'window-restore-killed-buffer-windows' which replaces
'window-kept-windows-functions'.
Fix some bugs with 'window-state-put' (Bug#69093). Add new
hook 'window-kept-windows-functions' (Bug#68235).
* doc/lispref/windows.texi (Window Configurations): Mention
'window-kept-windows-functions'.
(Window Hooks): Describe new abnormal hook
'window-kept-windows-functions'.
* src/marker.c (Fmarker_last_position): New function to return
the last position of a marker even if its buffer is now dead.
* src/window.c (Fset_window_configuration): If
'window-kept-windows-functions' is non-nil, do not delete any
window whose buffer is now dead but remember all such windows in
a list to pass to 'window-kept-windows-functions'. Run
'window-kept-windows-functions' if it is non-nil.
(Vwindow_kept_windows_functions): New abnormal hook run by
Fset_window_configuration and 'window-state-put' with two
arguments - the frame whose configuration is restored and a list
of entries for each window whose buffer was found dead during
restoration. Each entry is a list of four elements, the window,
the dead buffer, and the last know positions of the start and
point of that window.
* lisp/window.el (window-state-put-kept-windows)
(window-state-put-selected-window): New variables.
(window--state-put-2): Make sure buffer is live before restoring
its state. Set 'window-state-put-selected-window' to state's
selected window. If 'window-kept-windows-functions' is non-nil,
do not delete any windows whose buffer is found dead but
remember all such windows in a list to pass to
'window-kept-windows-functions'.
(window-state-put): Run 'window-kept-windows-functions' if it is
non-nil. Select window recorded in
'window-state-put-selected-window'.
* doc/lispref/windows.texi (Buffer Display Action Alists):
Add 'post-command-select-window'.
* lisp/window.el (display-buffer): Add 'post-command-select-window'
to the docstring and handle at the end of function.
* doc/lispref/buffers.texi (Buffer List):
* doc/lispref/windows.texi (Choosing Window): Add caveats for
calling 'buffer-match-p' too early, when CONDITION is
'derived-mode' or 'major-mode'. (Bug#68081)
Allow overriding the `pop-up-frames` variable from `display-buffer-alist`
so as to provide a worthy replacement for the old `same-frame`
parameter of `special-display-*` (bug#67249).
* lisp/window.el (special-display-popup-frame): Declare obsolete;
that was apparently forgotten back when `special-display-*` variables
were declared obsolete.
Use the new `pop-up-frames` action alist entry instead of the variable.
(display-buffer): Document new alist entry.
(window--pop-up-frames): New function.
(display-buffer--maybe-pop-up-frame, display-buffer-in-previous-window)
(display-buffer-reuse-window, display-buffer-reuse-mode-window): Use it.
* doc/lispref/windows.texi (Choosing Window Options): Mention that
`pop-up-frames` is also an action alist entry.
(Buffer Display Action Alists): Add `pop-up-frames` entry.
* src/window.c (Fwindow_use_time): Doc fix.
(Fwindow_bump_use_time): Bump use time of the seleceted window as
well. Doc fix.
* lisp/window.el (display-buffer-avoid-small-windows): Remove.
All users changed.
(window--display-buffer): Bump window use time when requested.
(display-buffer--lru-window): New function.
(display-buffer-use-some-window): Use it.
(display-buffer-use-least-recent-window): Rewrite and enhance doc
string.
* doc/lispref/windows.texi (Selecting Windows)
(Buffer Display Action Functions, Buffer Display Action Alists)
(The Zen of Buffer Display): Improve and update documentation of
window selection and display facilities.