summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2015-11-11 12:02:48 +0000
committerAlan Mackenzie <acm@muc.de>2015-12-04 18:15:27 +0000
commit64c57303658f69b019c4599f8c960a5623855410 (patch)
treecf49a687ba1784eb52451ab02a5d99013c88caab /doc
parent30f3432e9519f61882faa303e7851e761d2d18ea (diff)
downloademacs-64c57303658f69b019c4599f8c960a5623855410.tar.gz
First commit to scratch/follow. Make Isearch work with Follow Mode, etc.
doc/lispref/window.texi (Basic Windows): Add paragraph defining "Group of Windows" and new @defun selected-window-group. (Window Start and End): Describe new &optional parameter GROUP and ...-group-function for window-start, window-end, set-window-start, and pos-visible-in-window-p. (Textual Scrolling) Describe the same for recenter. doc/lispref/positions.texi (Screen Lines): Describe the same for move-to-window-line. src/window.c (Fwindow_start, Fwindow_end, Fset_window_start) (Fpos_visible_in_window_p, Frecenter, Fmove_to_window_line): To each, add ar new optional parameter "group". At the beginning of each, check whether the corresponding ...-group-function is set to a function, and if so execute this function in place of the normal processing. (syms_of_window): Define symbols for the six new variables below. (window-start-group-function, window-end-group-function) (set-window-start-group-function, recenter-group-function) (pos-visible-in-window-p-group-function, move-to-window-line-group-function): New permanent local buffer local variables. src/keyboard.c (Fposn_at_point): Add extra parameter in call to Fpos_visible_in_window_p. lisp/window.el (selected-window-group-function): New permanent local buffer local variable. (selected-window-group): New function. lisp/follow.el (follow-mode): Set the ...-group-function variables at mode enable, kill them at mode disable. Add/remove follow-after-change to/from after-change-functions. (follow-start-end-invalid): New variable. (follow-redisplay): Manipulate follow-start-end-invalid. (follow-after-change, follow-window-start, follow-window-end) (follow-set-window-start, follow-pos-visible-in-window-p) (follow-move-to-window-line, follow-sit-for): New functions. lisp/isearch.el (isearch-call-message): New macro. (isearch-update, with-isearch-suspended, isearch-del-char) (isearch-search-and-update, isearch-ring-adjust): Invoke above new macro. (with-isearch-suspended): Rearrange code such that isearch-call-message is invoked before point is moved. (isearch-message): Add comment about where point must be at function call. (isearch-search): Remove call to isearch-message. (isearch-lazy-highlight-window-group): New variable. (isearch-lazy-highlight-new-loop): Unconditionally start idle timer. Move the battery of tests to ... (isearch-lazy-highlight-maybe-new-loop): New function, started by idle timer. Note: (sit-for 0) is still called. (isearch-lazy-highlight-update): Check membership of isearch-lazy-highlight-window-group. Don't set the `window' overlay property. (isearch-update, isearch-done, isearch-string-out-of-window) (isearch-back-into-window, isearch-lazy-highlight-maybe-new-loop) (isearch-lazy-highlight-search, isearch-lazy-highlight-update) (isearch-lazy-highlight-update): Call the six amended primitives (see src/window.c above) with the new `group' argument set to t, to cooperate with Follow Mode.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/positions.texi13
-rw-r--r--doc/lispref/windows.texi87
2 files changed, 94 insertions, 6 deletions
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 72b76ce5c8f..e0496e30848 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -551,7 +551,8 @@ current buffer, regardless of which buffer is displayed in
any buffer, whether or not it is currently displayed in some window.
@end defun
-@deffn Command move-to-window-line count
+@deffn Command move-to-window-line count group
+@vindex move-to-window-line-group-function
This function moves point with respect to the text currently displayed
in the selected window. It moves point to the beginning of the screen
line @var{count} screen lines from the top of the window. If
@@ -570,6 +571,16 @@ In an interactive call, @var{count} is the numeric prefix argument.
The value returned is the window line number point has moved to, with
the top line in the window numbered 0.
+
+If @var{group} is non-@code{nil}, and the selected window is a part of
+a group of windows (@pxref{Basic Windows}), @code{move-to-window-line}
+will move to a position with respect to the entire group, not just the
+single window. This condition holds when the buffer local variable
+@code{move-to-window-line-group-function} is set to a function. In
+this case, @code{move-to-window-line} calls the function with the
+argument @var{count}, then returns its result, instead of performing
+the actions described above. Typically, the function will call
+@code{move-to-window-line} recursively.
@end deffn
@defun compute-motion from frompos to topos width offsets window
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 5c7947eeca6..f92289f51a4 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -133,6 +133,30 @@ This function returns the selected window (which is always a live
window).
@end defun
+ Sometimes several windows collectively and cooperatively display a
+buffer, for example, under the management of Follow Mode, where the
+windows together display a bigger portion of the buffer than one
+window could alone. It is often useful to consider such a @dfn{group
+of windows} as a single entity. Several functions such as
+@code{window-start} (@pxref{Window Start and End}) allow you to do
+this by supplying, as an argument, one of the windows as a stand in
+for the whole group.
+
+@defun selected-window-group
+@vindex selected-window-group-function
+When the selected window is a member of a group of windows, this
+function returns a list of the windows in the group, ordered such that
+the first window in the list is displaying the earliest part of the
+buffer, and so on. Otherwise the function returns a list containing
+just the selected window.
+
+The selected window is considered part of a group when the buffer
+local variable @code{selected-window-group-function} is set to a
+function. In this case, @code{selected-window-group} calls it with no
+arguments and returns its result (which should be the list of windows
+in the group).
+@end defun
+
@node Windows and Frames
@section Windows and Frames
@@ -3080,7 +3104,8 @@ using the commands of Lisp mode, because they trigger this
readjustment. To test such code, put it into a command and bind the
command to a key.
-@defun window-start &optional window
+@defun window-start &optional window group
+@vindex window-start-group-function
@cindex window top line
This function returns the display-start position of window
@var{window}. If @var{window} is @code{nil}, the selected window is
@@ -3096,10 +3121,20 @@ it explicitly since the previous redisplay)---to make sure point appears
on the screen. Nothing except redisplay automatically changes the
window-start position; if you move point, do not expect the window-start
position to change in response until after the next redisplay.
+
+If @var{group} is non-@code{nil}, and @var{window} is a part of a
+group of windows (@pxref{Basic Windows}), @code{window-start} returns
+the start position of the entire group. This condition holds when the
+buffer local variable @code{window-start-group-function} is set to a
+function. In this case, @code{window-start} calls the function with
+the single argument @var{window}, then returns its result, instead of
+performing the actions described above. Typically, the function will
+call @code{window-start} recursively.
@end defun
+@vindex window-end-group-function
@cindex window end position
-@defun window-end &optional window update
+@defun window-end &optional window update group
This function returns the position where display of its buffer ends in
@var{window}. The default for @var{window} is the selected window.
@@ -3122,9 +3157,19 @@ attempt to scroll the display if point has moved off the screen, the
way real redisplay would do. It does not alter the
@code{window-start} value. In effect, it reports where the displayed
text will end if scrolling is not required.
+
+If @var{group} is non-@code{nil}, and @var{window} is a part of a
+group of windows (@pxref{Basic Windows}), `window-end' returns the end
+position of the entire group. This condition holds when the buffer
+local variable @code{window-end-group-function} is set to a function.
+In this case, @code{window-end} calls the function with the two
+arguments @var{window} and @var{update}, then returns its result,
+instead of performing the actions described above. Typically, the
+function will call @code{window-end} recursively.
@end defun
-@defun set-window-start window position &optional noforce
+@vindex set-window-start-group-function
+@defun set-window-start window position &optional noforce group
This function sets the display-start position of @var{window} to
@var{position} in @var{window}'s buffer. It returns @var{position}.
@@ -3185,9 +3230,20 @@ it is still 1 when redisplay occurs. Here is an example:
If @var{noforce} is non-@code{nil}, and @var{position} would place point
off screen at the next redisplay, then redisplay computes a new window-start
position that works well with point, and thus @var{position} is not used.
+
+If @var{group} is non-@code{nil}, and @var{window} is a part of a
+group of windows (@pxref{Basic Windows}), @code{set-window-start} sets
+the start position of the entire group. This condition holds when the
+buffer local variable @code{set-window-start-group-function} is set to
+a function. In this case, @code{set-window-start} calls the function
+with the three arguments @var{window}, @var{position}, and
+@var{noforce}, then returns its result, instead of performing the
+actions described above. Typically, the function will call
+@code{set-window-start} recursively.
@end defun
-@defun pos-visible-in-window-p &optional position window partially
+@defun pos-visible-in-window-p &optional position window partially group
+@vindex pos-visible-in-window-p-group-function
This function returns non-@code{nil} if @var{position} is within the
range of text currently visible on the screen in @var{window}. It
returns @code{nil} if @var{position} is scrolled vertically out of
@@ -3226,6 +3282,18 @@ Here is an example:
(recenter 0))
@end group
@end example
+
+If @var{group} is non-@code{nil}, and @var{window} is a part of a
+group of windows (@pxref{Basic Windows}),
+@code{pos-visible-in-window-p} tests the visibility of @var{pos} in
+the entire group, not just in the single @var{window}. This condition
+holds when the buffer local variable
+@code{pos-visible-in-window-p-group-function} is set to a function.
+In this case @code{pos-visible-in-window-p} calls the function with
+the three arguments @var{position}, @var{window}, and @var{partially},
+then returns its result, instead of performing the actions described
+above. Typically, the function will call
+@code{pos-visible-in-window-p} recursively.
@end defun
@defun window-line-height &optional line window
@@ -3443,7 +3511,8 @@ beginning or end of the buffer (depending on scrolling direction);
only if point is already on that position do they signal an error.
@end defopt
-@deffn Command recenter &optional count
+@deffn Command recenter &optional count group
+@vindex recenter-group-function
@cindex centering point
This function scrolls the text in the selected window so that point is
displayed at a specified vertical position within the window. It does
@@ -3460,6 +3529,14 @@ If @var{count} is @code{nil} (or a non-@code{nil} list),
window. If @var{count} is @code{nil}, this function may redraw the
frame, according to the value of @code{recenter-redisplay}.
+If @var{group} is non-@code{nil}, and the selected window is part of a
+group of windows (@pxref{Basic Windows}), @code{recenter} scrolls the
+entire group. This condition holds when the buffer local variable
+@code{recenter-group-function} is set to a function. In this case,
+@code{recenter} calls the function with the argument @var{count}, then
+returns its result, instead of performing the actions described above.
+Typically, the function will call @code{recenter} recursively.
+
When @code{recenter} is called interactively, @var{count} is the raw
prefix argument. Thus, typing @kbd{C-u} as the prefix sets the
@var{count} to a non-@code{nil} list, while typing @kbd{C-u 4} sets