In Elisp manual warn about unpredictable changes of point (Bug#79927)

* doc/lispref/positions.texi (Point): Define "buffer point".
* doc/lispref/windows.texi (Window Point): Say that buffer point
can change in unpredictable ways when windows get selected
(Bug#79927).
This commit is contained in:
Martin Rudalics 2026-01-05 09:29:09 +01:00
parent b64e39f1b9
commit 6841869126
2 changed files with 22 additions and 6 deletions

View file

@ -57,14 +57,18 @@ buffer size plus 1. If narrowing is in effect (@pxref{Narrowing}), then
point is constrained to fall within the accessible portion of the buffer
(possibly at one end of it).
@cindex buffer point
Each buffer has its own value of point, which is independent of the
value of point in other buffers. Each window also has a value of point,
which is independent of the value of point in other windows on the same
buffer. This is why point can have different values in various windows
that display the same buffer. When a buffer appears in only one window,
the buffer's point and the window's point normally have the same value,
so the distinction is rarely important. @xref{Window Point}, for more
details.
which is independent of the value of point in other windows showing the
same buffer. This is why the cursor may appear at different positions
in various windows that display the same buffer. Wherever necessary, we
use the terms @dfn{buffer point} for the unique position of point of a
specific buffer and the term @dfn{window point} for the position of
point in a specific window showing that buffer. When a buffer appears
in only one window, its buffer's point and that window's point normally
have the same value, so the distinction is rarely important.
@xref{Window Point}, for more details.
@defun point
@cindex current buffer position

View file

@ -5872,6 +5872,18 @@ the other windows are stored in those windows.
@item
As long as the selected window displays the current buffer, the window's
point and the buffer's point always move together; they remain equal.
@item
Many Emacs functions temporarily select a window in order to operate on
its contents. This will move the buffer point (@pxref{Point}) of that
window's buffer to the position of the window point of that window and
not restore the buffer point to its previous position when terminating
the temporary selection. This means that when one and the same buffer
is simultaneously displayed in more than one window, its buffer point
may change in unpredictable ways to the position of window point of any
of these windows as a side-effect of things like redisplay, calling
@code{with-selected-window} (@pxref{Selecting Windows}) or running
@code{window-configuration-change-hook} (@pxref{Window Hooks}).
@end itemize
@cindex cursor