1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-03 04:21:28 -08:00
emacs/doc/lispref
Martin Rudalics 27381d71c6 Improve window/buffer handling code
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'.
2024-08-01 09:37:50 +02:00
..
abbrevs.texi Update NEWS and manual after obarray changes 2024-02-23 13:02:27 +01:00
anti.texi Write Antinews for Emacs 30 ELisp Reference 2024-06-27 21:54:52 +03:00
back.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
backups.texi New variable 'revert-buffer-restore-functions' (bug#69511) 2024-06-03 19:55:47 +03:00
book-spine.texi
buffers.texi ; Fix documentation of a recent change (bug#68235) 2024-03-15 14:22:14 +02:00
ChangeLog.1 ; Fix typos 2024-06-23 16:40:06 +02:00
commands.texi Merge from savannah/emacs-30 2024-07-24 11:41:58 +08:00
compile.texi ; Improve a recent change to the documentation 2024-07-08 14:48:25 +03:00
control.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
customize.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
debugging.texi Improve documentation of profiler commands 2024-01-24 21:34:16 +02:00
display.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
doclicense.texi
edebug.texi Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
elisp.texi Write Antinews for Emacs 30 ELisp Reference 2024-06-27 21:54:52 +03:00
elisp_type_hierarchy.jpg Run admin/syncdoc-type-hierarchy.el 2024-04-23 15:39:28 +02:00
elisp_type_hierarchy.txt Run admin/syncdoc-type-hierarchy.el 2024-04-23 15:39:28 +02:00
errors.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
eval.texi eval.c: Add new var lisp-eval-depth-reserve 2024-01-04 16:36:22 -05:00
files.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
frames.texi Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
functions.texi Merge from origin/emacs-30 2024-07-27 04:27:53 -04:00
gpl.texi
hash.texi Clarify permitted mutation in maphash documentation 2024-01-21 11:21:51 +01:00
help.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
hooks.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
index.texi
internals.texi Merge from origin/emacs-29 2024-01-13 05:36:16 -05:00
intro.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
keymaps.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
lay-flat.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
lists.texi Add drop as alias for nthcdr 2024-04-29 14:29:52 +02:00
loading.texi Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
macros.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
Makefile.in Add peg.el as a built-in library 2024-03-30 15:19:47 -07:00
maps.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
markers.texi ; Fix recent changes in documentation 2024-03-16 11:58:56 +02:00
minibuf.texi minibuffer-allow-text-properties can be buffer-local and affects completions 2024-05-27 21:19:53 +03:00
modes.texi ; * doc/lispref/modes.texi (Mode Line Data): Fix formatting. 2024-07-27 15:56:47 +03:00
nonascii.texi Merge from origin/emacs-30 2024-07-27 04:27:53 -04:00
numbers.texi Add value< (bug#69709) 2024-03-29 11:39:38 +01:00
objects.texi ; * doc/lispref/objects.texi (Type Predicates): fix xrefs 2024-04-29 14:29:52 +02:00
os.texi Port more notification senders to non-XDG systems 2024-03-13 11:01:39 +08:00
package.texi Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
parsing.texi New variable treesit-language-remap-alist (bug#72388) 2024-07-30 17:09:58 -07:00
peg.texi ; Fix typos 2024-06-23 16:40:06 +02:00
positions.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
processes.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
README ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
records.texi Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
searching.texi Standardize possessive apostrophe usage in manuals, docs, and comments 2024-07-25 03:35:18 +02:00
sequences.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
spellfile
streams.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
strings.texi ; Don't use non-ASCII in ELisp manual sources unless necessary 2024-07-26 14:11:17 +03:00
symbols.texi Change bare-symbol back to match intent 2024-03-11 00:34:27 -07:00
syntax.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
text.texi ; Improve documentation of 'line-prefix' and 'wrap-prefix'. 2024-07-26 14:56:14 +03:00
threads.texi ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
tips.texi Document GNU ELPA copyright in tips.texi 2024-07-20 07:46:37 +02:00
two-volume-cross-refs.txt ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
two-volume.make ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
variables.texi ; Fix punctuation in docs 2024-07-21 17:35:13 +02:00
windows.texi Improve window/buffer handling code 2024-08-01 09:37:50 +02:00

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Copyright (C) 2001-2024 Free Software Foundation, Inc.  -*- outline -*-
See the end of the file for license conditions.


README for the Emacs Lisp Reference Manual.

* This directory contains the texinfo source files for the Emacs Lisp
Reference Manual.

* Report bugs in the Lisp Manual (or in Emacs) using M-x report-emacs-bug.
To ask questions, use the help-gnu-emacs mailing list.

* The Emacs Lisp Reference Manual is quite large.  It totals around
1100 pages in smallbook format; the info files total around 3.0 megabytes.

* You can format this manual for Info, for printing hardcopy using TeX,
or for HTML.

* You can buy nicely printed copies from the Free Software Foundation.
Buying a manual from the Free Software Foundation helps support our GNU
development work.  See <https://shop.fsf.org/>.
(At time of writing, this manual is out of print.)

* The master file for formatting this manual for Tex is called 'elisp.texi'.
It contains @include commands to include all the chapters that make up
the manual.

* This distribution contains a Makefile that you can use with GNU Make.

** To make an Info file, you need to install Texinfo, then run 'make info'.

** Use 'make elisp.pdf' or 'make elisp.html' to create PDF or HTML versions.


This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.