diff options
| author | Alan Mackenzie | 2015-11-11 12:02:48 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2015-11-11 12:02:48 +0000 |
| commit | 2c56fc2a3f106a1286ad793eed9bfaafd09a7411 (patch) | |
| tree | 6082e9df4733fb39a9d1423568a703c93f7ead62 /doc | |
| parent | 25775a12c5168b0494dff15639ac25d8e1017530 (diff) | |
| download | emacs-2c56fc2a3f106a1286ad793eed9bfaafd09a7411.tar.gz emacs-2c56fc2a3f106a1286ad793eed9bfaafd09a7411.zip | |
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.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 87 |
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 | |||
| 551 | any buffer, whether or not it is currently displayed in some window. | 551 | any buffer, whether or not it is currently displayed in some window. |
| 552 | @end defun | 552 | @end defun |
| 553 | 553 | ||
| 554 | @deffn Command move-to-window-line count | 554 | @deffn Command move-to-window-line count group |
| 555 | @vindex move-to-window-line-group-function | ||
| 555 | This function moves point with respect to the text currently displayed | 556 | This function moves point with respect to the text currently displayed |
| 556 | in the selected window. It moves point to the beginning of the screen | 557 | in the selected window. It moves point to the beginning of the screen |
| 557 | line @var{count} screen lines from the top of the window. If | 558 | 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. | |||
| 570 | 571 | ||
| 571 | The value returned is the window line number point has moved to, with | 572 | The value returned is the window line number point has moved to, with |
| 572 | the top line in the window numbered 0. | 573 | the top line in the window numbered 0. |
| 574 | |||
| 575 | If @var{group} is non-@code{nil}, and the selected window is a part of | ||
| 576 | a group of windows (@pxref{Basic Windows}), @code{move-to-window-line} | ||
| 577 | will move to a position with respect to the entire group, not just the | ||
| 578 | single window. This condition holds when the buffer local variable | ||
| 579 | @code{move-to-window-line-group-function} is set to a function. In | ||
| 580 | this case, @code{move-to-window-line} calls the function with the | ||
| 581 | argument @var{count}, then returns its result, instead of performing | ||
| 582 | the actions described above. Typically, the function will call | ||
| 583 | @code{move-to-window-line} recursively. | ||
| 573 | @end deffn | 584 | @end deffn |
| 574 | 585 | ||
| 575 | @defun compute-motion from frompos to topos width offsets window | 586 | @defun compute-motion from frompos to topos width offsets window |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 357247ef433..832ced719cd 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 | |||
| 133 | window). | 133 | window). |
| 134 | @end defun | 134 | @end defun |
| 135 | 135 | ||
| 136 | Sometimes several windows collectively and cooperatively display a | ||
| 137 | buffer, for example, under the management of Follow Mode, where the | ||
| 138 | windows together display a bigger portion of the buffer than one | ||
| 139 | window could alone. It is often useful to consider such a @dfn{group | ||
| 140 | of windows} as a single entity. Several functions such as | ||
| 141 | @code{window-start} (@pxref{Window Start and End}) allow you to do | ||
| 142 | this by supplying, as an argument, one of the windows as a stand in | ||
| 143 | for the whole group. | ||
| 144 | |||
| 145 | @defun selected-window-group | ||
| 146 | @vindex selected-window-group-function | ||
| 147 | When the selected window is a member of a group of windows, this | ||
| 148 | function returns a list of the windows in the group, ordered such that | ||
| 149 | the first window in the list is displaying the earliest part of the | ||
| 150 | buffer, and so on. Otherwise the function returns a list containing | ||
| 151 | just the selected window. | ||
| 152 | |||
| 153 | The selected window is considered part of a group when the buffer | ||
| 154 | local variable @code{selected-window-group-function} is set to a | ||
| 155 | function. In this case, @code{selected-window-group} calls it with no | ||
| 156 | arguments and returns its result (which should be the list of windows | ||
| 157 | in the group). | ||
| 158 | @end defun | ||
| 159 | |||
| 136 | @node Windows and Frames | 160 | @node Windows and Frames |
| 137 | @section Windows and Frames | 161 | @section Windows and Frames |
| 138 | 162 | ||
| @@ -3064,7 +3088,8 @@ using the commands of Lisp mode, because they trigger this | |||
| 3064 | readjustment. To test such code, put it into a command and bind the | 3088 | readjustment. To test such code, put it into a command and bind the |
| 3065 | command to a key. | 3089 | command to a key. |
| 3066 | 3090 | ||
| 3067 | @defun window-start &optional window | 3091 | @defun window-start &optional window group |
| 3092 | @vindex window-start-group-function | ||
| 3068 | @cindex window top line | 3093 | @cindex window top line |
| 3069 | This function returns the display-start position of window | 3094 | This function returns the display-start position of window |
| 3070 | @var{window}. If @var{window} is @code{nil}, the selected window is | 3095 | @var{window}. If @var{window} is @code{nil}, the selected window is |
| @@ -3080,10 +3105,20 @@ it explicitly since the previous redisplay)---to make sure point appears | |||
| 3080 | on the screen. Nothing except redisplay automatically changes the | 3105 | on the screen. Nothing except redisplay automatically changes the |
| 3081 | window-start position; if you move point, do not expect the window-start | 3106 | window-start position; if you move point, do not expect the window-start |
| 3082 | position to change in response until after the next redisplay. | 3107 | position to change in response until after the next redisplay. |
| 3108 | |||
| 3109 | If @var{group} is non-@code{nil}, and @var{window} is a part of a | ||
| 3110 | group of windows (@pxref{Basic Windows}), @code{window-start} returns | ||
| 3111 | the start position of the entire group. This condition holds when the | ||
| 3112 | buffer local variable @code{window-start-group-function} is set to a | ||
| 3113 | function. In this case, @code{window-start} calls the function with | ||
| 3114 | the single argument @var{window}, then returns its result, instead of | ||
| 3115 | performing the actions described above. Typically, the function will | ||
| 3116 | call @code{window-start} recursively. | ||
| 3083 | @end defun | 3117 | @end defun |
| 3084 | 3118 | ||
| 3119 | @vindex window-end-group-function | ||
| 3085 | @cindex window end position | 3120 | @cindex window end position |
| 3086 | @defun window-end &optional window update | 3121 | @defun window-end &optional window update group |
| 3087 | This function returns the position where display of its buffer ends in | 3122 | This function returns the position where display of its buffer ends in |
| 3088 | @var{window}. The default for @var{window} is the selected window. | 3123 | @var{window}. The default for @var{window} is the selected window. |
| 3089 | 3124 | ||
| @@ -3106,9 +3141,19 @@ attempt to scroll the display if point has moved off the screen, the | |||
| 3106 | way real redisplay would do. It does not alter the | 3141 | way real redisplay would do. It does not alter the |
| 3107 | @code{window-start} value. In effect, it reports where the displayed | 3142 | @code{window-start} value. In effect, it reports where the displayed |
| 3108 | text will end if scrolling is not required. | 3143 | text will end if scrolling is not required. |
| 3144 | |||
| 3145 | If @var{group} is non-@code{nil}, and @var{window} is a part of a | ||
| 3146 | group of windows (@pxref{Basic Windows}), `window-end' returns the end | ||
| 3147 | position of the entire group. This condition holds when the buffer | ||
| 3148 | local variable @code{window-end-group-function} is set to a function. | ||
| 3149 | In this case, @code{window-end} calls the function with the two | ||
| 3150 | arguments @var{window} and @var{update}, then returns its result, | ||
| 3151 | instead of performing the actions described above. Typically, the | ||
| 3152 | function will call @code{window-end} recursively. | ||
| 3109 | @end defun | 3153 | @end defun |
| 3110 | 3154 | ||
| 3111 | @defun set-window-start window position &optional noforce | 3155 | @vindex set-window-start-group-function |
| 3156 | @defun set-window-start window position &optional noforce group | ||
| 3112 | This function sets the display-start position of @var{window} to | 3157 | This function sets the display-start position of @var{window} to |
| 3113 | @var{position} in @var{window}'s buffer. It returns @var{position}. | 3158 | @var{position} in @var{window}'s buffer. It returns @var{position}. |
| 3114 | 3159 | ||
| @@ -3169,9 +3214,20 @@ it is still 1 when redisplay occurs. Here is an example: | |||
| 3169 | If @var{noforce} is non-@code{nil}, and @var{position} would place point | 3214 | If @var{noforce} is non-@code{nil}, and @var{position} would place point |
| 3170 | off screen at the next redisplay, then redisplay computes a new window-start | 3215 | off screen at the next redisplay, then redisplay computes a new window-start |
| 3171 | position that works well with point, and thus @var{position} is not used. | 3216 | position that works well with point, and thus @var{position} is not used. |
| 3217 | |||
| 3218 | If @var{group} is non-@code{nil}, and @var{window} is a part of a | ||
| 3219 | group of windows (@pxref{Basic Windows}), @code{set-window-start} sets | ||
| 3220 | the start position of the entire group. This condition holds when the | ||
| 3221 | buffer local variable @code{set-window-start-group-function} is set to | ||
| 3222 | a function. In this case, @code{set-window-start} calls the function | ||
| 3223 | with the three arguments @var{window}, @var{position}, and | ||
| 3224 | @var{noforce}, then returns its result, instead of performing the | ||
| 3225 | actions described above. Typically, the function will call | ||
| 3226 | @code{set-window-start} recursively. | ||
| 3172 | @end defun | 3227 | @end defun |
| 3173 | 3228 | ||
| 3174 | @defun pos-visible-in-window-p &optional position window partially | 3229 | @defun pos-visible-in-window-p &optional position window partially group |
| 3230 | @vindex pos-visible-in-window-p-group-function | ||
| 3175 | This function returns non-@code{nil} if @var{position} is within the | 3231 | This function returns non-@code{nil} if @var{position} is within the |
| 3176 | range of text currently visible on the screen in @var{window}. It | 3232 | range of text currently visible on the screen in @var{window}. It |
| 3177 | returns @code{nil} if @var{position} is scrolled vertically out of | 3233 | returns @code{nil} if @var{position} is scrolled vertically out of |
| @@ -3210,6 +3266,18 @@ Here is an example: | |||
| 3210 | (recenter 0)) | 3266 | (recenter 0)) |
| 3211 | @end group | 3267 | @end group |
| 3212 | @end example | 3268 | @end example |
| 3269 | |||
| 3270 | If @var{group} is non-@code{nil}, and @var{window} is a part of a | ||
| 3271 | group of windows (@pxref{Basic Windows}), | ||
| 3272 | @code{pos-visible-in-window-p} tests the visibility of @var{pos} in | ||
| 3273 | the entire group, not just in the single @var{window}. This condition | ||
| 3274 | holds when the buffer local variable | ||
| 3275 | @code{pos-visible-in-window-p-group-function} is set to a function. | ||
| 3276 | In this case @code{pos-visible-in-window-p} calls the function with | ||
| 3277 | the three arguments @var{position}, @var{window}, and @var{partially}, | ||
| 3278 | then returns its result, instead of performing the actions described | ||
| 3279 | above. Typically, the function will call | ||
| 3280 | @code{pos-visible-in-window-p} recursively. | ||
| 3213 | @end defun | 3281 | @end defun |
| 3214 | 3282 | ||
| 3215 | @defun window-line-height &optional line window | 3283 | @defun window-line-height &optional line window |
| @@ -3427,7 +3495,8 @@ beginning or end of the buffer (depending on scrolling direction); | |||
| 3427 | only if point is already on that position do they signal an error. | 3495 | only if point is already on that position do they signal an error. |
| 3428 | @end defopt | 3496 | @end defopt |
| 3429 | 3497 | ||
| 3430 | @deffn Command recenter &optional count | 3498 | @deffn Command recenter &optional count group |
| 3499 | @vindex recenter-group-function | ||
| 3431 | @cindex centering point | 3500 | @cindex centering point |
| 3432 | This function scrolls the text in the selected window so that point is | 3501 | This function scrolls the text in the selected window so that point is |
| 3433 | displayed at a specified vertical position within the window. It does | 3502 | displayed at a specified vertical position within the window. It does |
| @@ -3444,6 +3513,14 @@ If @var{count} is @code{nil} (or a non-@code{nil} list), | |||
| 3444 | window. If @var{count} is @code{nil}, this function may redraw the | 3513 | window. If @var{count} is @code{nil}, this function may redraw the |
| 3445 | frame, according to the value of @code{recenter-redisplay}. | 3514 | frame, according to the value of @code{recenter-redisplay}. |
| 3446 | 3515 | ||
| 3516 | If @var{group} is non-@code{nil}, and the selected window is part of a | ||
| 3517 | group of windows (@pxref{Basic Windows}), @code{recenter} scrolls the | ||
| 3518 | entire group. This condition holds when the buffer local variable | ||
| 3519 | @code{recenter-group-function} is set to a function. In this case, | ||
| 3520 | @code{recenter} calls the function with the argument @var{count}, then | ||
| 3521 | returns its result, instead of performing the actions described above. | ||
| 3522 | Typically, the function will call @code{recenter} recursively. | ||
| 3523 | |||
| 3447 | When @code{recenter} is called interactively, @var{count} is the raw | 3524 | When @code{recenter} is called interactively, @var{count} is the raw |
| 3448 | prefix argument. Thus, typing @kbd{C-u} as the prefix sets the | 3525 | prefix argument. Thus, typing @kbd{C-u} as the prefix sets the |
| 3449 | @var{count} to a non-@code{nil} list, while typing @kbd{C-u 4} sets | 3526 | @var{count} to a non-@code{nil} list, while typing @kbd{C-u 4} sets |