Commit e8937de5 authored by Alan Mackenzie's avatar Alan Mackenzie

Replace GROUP argument in six window primitives by new functions.

* doc/lispref/windows.texi (Window Start and End, Textual Scrolling)
* doc/lispref/positions.texi (Screen Lines): Remove optional GROUP argument
from description of six window functions.  Add in description of new functions
window-group-start, window-group-end, set-window-group-start,
pos-visible-in-window-group-p, recenter-group and move-to-window-group-line,
together with the six variables indirecting to the pertinent group
functions.

* src/window.c
* src/keyboard.c: Revert the commit from 2015-11-11 12:02:48, in so far as it
applies to these two files, which added the GROUP argument to six window
primitives.

* lisp/follow.el (follow-mode): Use updated variable names for the indirected
functions.

* lisp/isearch.el (isearch-update, isearch-done, isearch-string-out-of-window)
(isearch-back-into-window, isearch-lazy-highlight-new-loop)
(isearch-lazy-highlight-search, isearch-lazy-highlight-update): Replace calls
to window primitives (e.g. window-start) with a GROUP argument by calls to
new functions (e.g. window-group-start).

* lisp/ispell.el (ispell-command-loop): Replace call to
pos-visible-in-window-p with pos-visible-in-window-group-p.

* lisp/window.el (window-group-start, window-group-end)
(set-window-group-start, recenter-group, pos-visible-in-window-group-p)
(selected-window-group, move-to-window-group-line): New functions.
(window-group-start-function, window-group-end-function)
(set-window-group-start-function, recenter-group-function)
(pos-visible-in-window-group-p-function, selected-window-group-function)
(move-to-window-group-line-function): New variables.
parent 3194f1cc
......@@ -551,8 +551,7 @@ 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 group
@vindex move-to-window-line-group-function
@deffn Command move-to-window-line count
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
......@@ -571,18 +570,21 @@ 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
@vindex move-to-window-group-line-function
@defun move-to-window-group-line count
This function is like @code{move-to-window-line}, except that when the
selected window is a part of a group of windows (@pxref{Basic
Windows}), @code{move-to-window-group-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-group-line-function} is set to a function. In
this case, @code{move-to-window-group-line} calls the function with
the argument @var{count}, then returns its result. The argument has
the same meaning as in @code{move-to-window-line}.
@end defun
@defun compute-motion from frompos to topos width offsets window
This function scans the current buffer, calculating screen positions.
It scans the buffer forward from position @var{from}, assuming that is
......
......@@ -3104,8 +3104,7 @@ 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 group
@vindex window-start-group-function
@defun window-start &optional window
@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
......@@ -3121,20 +3120,22 @@ 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.
@end defun
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.
@defun window-group-start &optional window
@vindex window-group-start-function
This function is like @code{window-start}, except that when
@var{window} is a part of a group of windows (@pxref{Basic Windows}),
@code{window-group-start} returns the start position of the entire
group. This condition holds when the buffer local variable
@code{window-group-start-function} is set to a function. In this
case, @code{window-group-start} calls the function with the single
argument @var{window}, then returns its result. The argument to this
function has the same meaning as in @code{window-start}.
@end defun
@vindex window-end-group-function
@cindex window end position
@defun window-end &optional window update group
@defun window-end &optional window update
This function returns the position where display of its buffer ends in
@var{window}. The default for @var{window} is the selected window.
......@@ -3157,19 +3158,21 @@ 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.
@end defun
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.
@vindex window-group-end-function
@defun window-group-end window update
This function is like @code{window-end}, except that when @var{window}
is a part of a group of windows (@pxref{Basic Windows}),
@code{window-group-end} returns the end position of the entire group.
This condition holds when the buffer local variable
@code{window-group-end-function} is set to a function. In this case,
@code{window-group-end} calls the function with the two arguments
@var{window} and @var{update}, then returns its result. The arguments
to this function have the same meaning as in @code{window-end}.
@end defun
@vindex set-window-start-group-function
@defun set-window-start window position &optional noforce group
@defun set-window-start window position &optional noforce
This function sets the display-start position of @var{window} to
@var{position} in @var{window}'s buffer. It returns @var{position}.
......@@ -3230,20 +3233,22 @@ 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.
@end defun
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.
@vindex set-window-group-start-function
@defun set-window-group-start window position &optional noforce
This function is like @code{set-window-start}, except that when
@var{window} is a part of a group of windows (@pxref{Basic Windows}),
@code{set-window-group-start} sets the start position of the entire
group. This condition holds when the buffer local variable
@code{set-window-group-start-function} is set to a function. In this
case, @code{set-window-group-start} calls the function with the three
arguments @var{window}, @var{position}, and @var{noforce}, then
returns its result. The arguments in this function have the same
meaning as in @code{set-window-start}.
@end defun
@defun pos-visible-in-window-p &optional position window partially group
@vindex pos-visible-in-window-p-group-function
@defun pos-visible-in-window-p &optional position window partially
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
......@@ -3282,18 +3287,19 @@ Here is an example:
(recenter 0))
@end group
@end example
@end defun
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.
@vindex pos-visible-in-window-group-p-function
@defun pos-visible-in-window-group-p &optional position window partially
This function is like @code{pos-visible-in-window-p}, except that when
@var{window} is a part of a group of windows (@pxref{Basic Windows}),
@code{pos-visible-in-window-group-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-group-p-function} is set to a function.
In this case @code{pos-visible-in-window-group-p} calls the function
with the three arguments @var{position}, @var{window}, and
@var{partially}, then returns its result.
@end defun
@defun window-line-height &optional line window
......@@ -3511,8 +3517,7 @@ 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 group
@vindex recenter-group-function
@deffn Command recenter &optional count
@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
......@@ -3529,14 +3534,6 @@ 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
......@@ -3548,6 +3545,17 @@ the top of the window. The command @code{recenter-top-bottom} offers
a more convenient way to achieve this.
@end deffn
@vindex recenter-group-function
@defun recenter-group &optional count
This function is like @code{recenter}, except that when the selected
window is part of a group of windows (@pxref{Basic Windows}),
@code{recenter-group} 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-group} calls the function
with the argument @var{count}, then returns its result. The argument
has the same meaning as in @code{recenter}.
@end defun
@defopt recenter-redisplay
If this variable is non-@code{nil}, calling @code{recenter} with a
@code{nil} argument redraws the frame. The default value is
......
......@@ -427,14 +427,14 @@ Keys specific to Follow mode:
(add-hook 'replace-update-post-hook 'follow-post-command-hook nil t)
(add-hook 'ispell-update-post-hook 'follow-post-command-hook nil t)
(setq window-start-group-function 'follow-window-start)
(setq window-end-group-function 'follow-window-end)
(setq set-window-start-group-function 'follow-set-window-start)
(setq window-group-start-function 'follow-window-start)
(setq window-group-end-function 'follow-window-end)
(setq set-window-group-start-function 'follow-set-window-start)
(setq recenter-group-function 'follow-recenter)
(setq pos-visible-in-window-p-group-function
(setq pos-visible-in-window-group-p-function
'follow-pos-visible-in-window-p)
(setq selected-window-group-function 'follow-all-followers)
(setq move-to-window-line-group-function 'follow-move-to-window-line))
(setq move-to-window-group-line-function 'follow-move-to-window-line))
;; Remove globally-installed hook functions only if there is no
;; other Follow mode buffer.
......@@ -447,13 +447,13 @@ Keys specific to Follow mode:
(remove-hook 'post-command-hook 'follow-post-command-hook)
(remove-hook 'window-size-change-functions 'follow-window-size-change)))
(kill-local-variable 'move-to-window-line-group-function)
(kill-local-variable 'move-to-window-group-line-function)
(kill-local-variable 'selected-window-group-function)
(kill-local-variable 'pos-visible-in-window-p-group-function)
(kill-local-variable 'pos-visible-in-window-group-p-function)
(kill-local-variable 'recenter-group-function)
(kill-local-variable 'set-window-start-group-function)
(kill-local-variable 'window-end-group-function)
(kill-local-variable 'window-start-group-function)
(kill-local-variable 'set-window-group-start-function)
(kill-local-variable 'window-group-end-function)
(kill-local-variable 'window-group-start-function)
(remove-hook 'ispell-update-post-hook 'follow-post-command-hook t)
(remove-hook 'replace-update-post-hook 'follow-post-command-hook t)
......
......@@ -982,7 +982,7 @@ The last thing is to trigger a new round of lazy highlighting."
(funcall (or isearch-message-function #'isearch-message)))
(if (and isearch-slow-terminal-mode
(not (or isearch-small-window
(pos-visible-in-window-p nil nil nil t))))
(pos-visible-in-window-group-p))))
(let ((found-point (point)))
(setq isearch-small-window t)
(move-to-window-line 0)
......@@ -1003,10 +1003,10 @@ The last thing is to trigger a new round of lazy highlighting."
(let ((current-scroll (window-hscroll))
visible-p)
(set-window-hscroll (selected-window) isearch-start-hscroll)
(setq visible-p (pos-visible-in-window-p nil nil t t))
(setq visible-p (pos-visible-in-window-group-p nil nil t))
(if (or (not visible-p)
;; When point is not visible because of hscroll,
;; pos-visible-in-window-p returns non-nil, but
;; pos-visible-in-window-group-p returns non-nil, but
;; the X coordinate it returns is 1 pixel beyond
;; the last visible one.
(>= (car visible-p) (window-body-width nil t)))
......@@ -1057,7 +1057,7 @@ NOPUSH is t and EDIT is t."
(setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
(isearch-dehighlight)
(lazy-highlight-cleanup lazy-highlight-cleanup)
(let ((found-start (window-start nil t))
(let ((found-start (window-group-start))
(found-point (point)))
(when isearch-window-configuration
(set-window-configuration isearch-window-configuration)
......@@ -1067,7 +1067,7 @@ NOPUSH is t and EDIT is t."
;; This has an annoying side effect of clearing the last_modiff
;; field of the window, which can cause unwanted scrolling,
;; so don't do it unless truly necessary.
(set-window-start (selected-window) found-start t t))))
(set-window-group-start (selected-window) found-start t))))
(setq isearch-mode nil)
(if isearch-input-method-local-p
......@@ -2279,12 +2279,12 @@ Return nil if it's completely visible, or if point is visible,
together with as much of the search string as will fit; the symbol
`above' if we need to scroll the text downwards; the symbol `below',
if upwards."
(let ((w-start (window-start nil t))
(w-end (window-end nil t t))
(let ((w-start (window-group-start))
(w-end (window-group-end nil t))
(w-L1 (save-excursion
(save-selected-window (move-to-window-line 1 t) (point))))
(save-selected-window (move-to-window-group-line 1) (point))))
(w-L-1 (save-excursion
(save-selected-window (move-to-window-line -1 t) (point))))
(save-selected-window (move-to-window-group-line -1) (point))))
start end) ; start and end of search string in buffer
(if isearch-forward
(setq end isearch-point start (or isearch-other-end isearch-point))
......@@ -2311,15 +2311,15 @@ the bottom."
(if above
(progn
(goto-char start)
(recenter 0 t)
(when (>= isearch-point (window-end nil t t))
(recenter-group 0)
(when (>= isearch-point (window-group-end nil t))
(goto-char isearch-point)
(recenter -1 t)))
(recenter-group -1)))
(goto-char end)
(recenter -1 t)
(when (< isearch-point (window-start nil t))
(recenter-group -1)
(when (< isearch-point (window-group-start))
(goto-char isearch-point)
(recenter 0 t))))
(recenter-group 0))))
(goto-char isearch-point))
(defvar isearch-pre-scroll-point nil)
......@@ -3090,9 +3090,9 @@ by other Emacs features."
isearch-lax-whitespace))
(not (eq isearch-lazy-highlight-regexp-lax-whitespace
isearch-regexp-lax-whitespace))
(not (= (window-start nil t)
(not (= (window-group-start)
isearch-lazy-highlight-window-start))
(not (= (window-end nil nil t) ; Window may have been split/joined.
(not (= (window-group-end) ; Window may have been split/joined.
isearch-lazy-highlight-window-end))
(not (eq isearch-forward
isearch-lazy-highlight-forward))
......@@ -3109,8 +3109,8 @@ by other Emacs features."
isearch-lazy-highlight-end-limit end)
(setq isearch-lazy-highlight-window (selected-window)
isearch-lazy-highlight-window-group (selected-window-group)
isearch-lazy-highlight-window-start (window-start nil t)
isearch-lazy-highlight-window-end (window-end nil nil t)
isearch-lazy-highlight-window-start (window-group-start)
isearch-lazy-highlight-window-end (window-group-end)
;; Start lazy-highlighting at the beginning of the found
;; match (`isearch-other-end'). If no match, use point.
;; One of the next two variables (depending on search direction)
......@@ -3154,13 +3154,13 @@ Attempt to do the search exactly the way the pending Isearch would."
(+ isearch-lazy-highlight-start
;; Extend bound to match whole string at point
(1- (length isearch-lazy-highlight-last-string)))
(window-end nil nil t)))
(window-group-end)))
(max (or isearch-lazy-highlight-start-limit (point-min))
(if isearch-lazy-highlight-wrapped
(- isearch-lazy-highlight-end
;; Extend bound to match whole string at point
(1- (length isearch-lazy-highlight-last-string)))
(window-start nil t))))))
(window-group-start))))))
;; Use a loop like in `isearch-search'.
(while retry
(setq success (isearch-search-string
......@@ -3204,12 +3204,12 @@ Attempt to do the search exactly the way the pending Isearch would."
(if isearch-lazy-highlight-forward
(if (= mb (if isearch-lazy-highlight-wrapped
isearch-lazy-highlight-start
(window-end nil nil t)))
(window-group-end)))
(setq found nil)
(forward-char 1))
(if (= mb (if isearch-lazy-highlight-wrapped
isearch-lazy-highlight-end
(window-start nil t)))
(window-group-start)))
(setq found nil)
(forward-char -1)))
......@@ -3236,12 +3236,12 @@ Attempt to do the search exactly the way the pending Isearch would."
(setq isearch-lazy-highlight-wrapped t)
(if isearch-lazy-highlight-forward
(progn
(setq isearch-lazy-highlight-end (window-start nil t))
(setq isearch-lazy-highlight-end (window-group-start))
(goto-char (max (or isearch-lazy-highlight-start-limit (point-min))
(window-start nil t))))
(setq isearch-lazy-highlight-start (window-end nil nil t))
(window-group-start))))
(setq isearch-lazy-highlight-start (window-group-end))
(goto-char (min (or isearch-lazy-highlight-end-limit (point-max))
(window-end nil nil t))))))))
(window-group-end))))))))
(unless nomore
(setq isearch-lazy-highlight-timer
(run-at-time lazy-highlight-interval nil
......
......@@ -2323,7 +2323,7 @@ Global `ispell-quit' set to start location to continue spell session."
(run-hooks 'ispell-update-post-hook)
;; ensure word is visible
(if (not (pos-visible-in-window-p end nil nil t))
(if (not (pos-visible-in-window-group-p end))
(sit-for 0))
;; Display choices for misspelled word.
......
......@@ -28,17 +28,6 @@
;;; Code:
(defvar selected-window-group-function nil)
(make-variable-buffer-local 'selected-window-group-function)
(put 'selected-window-group-function 'permanent-local t)
(defun selected-window-group ()
"Return the list of windows in the group containing the selected window.
When a grouping mode (such as Follow Mode) is not active, the
result is a list containing only the selected window."
(if (functionp selected-window-group-function)
(funcall selected-window-group-function)
(list (selected-window))))
(defun internal--before-save-selected-window ()
(cons (selected-window)
;; We save and restore all frames' selected windows, because
......@@ -7880,6 +7869,152 @@ Return non-nil if the window was shrunk, nil otherwise."
(with-current-buffer buffer-to-kill
(remove-hook 'kill-buffer-hook delete-window-hook t))))))
;;;
;; Groups of windows (Follow Mode).
;;
;; This section of functions extends the functionality of some window
;; manipulating commands to groups of windows co-operatively
;; displaying a buffer, typically with Follow Mode.
;;
;; The xxx-function variables are permanent locals so that their local
;; status is undone only when explicitly programmed, not when a buffer
;; is reverted or a mode function is called.
(defvar window-group-start-function nil)
(make-variable-buffer-local 'window-group-start-function)
(put 'window-group-start-function 'permanent-local t)
(defun window-group-start (&optional window)
"Return position at which display currently starts in the group of
windows containing WINDOW. When a grouping mode (such as Follow Mode)
is not active, this function is identical to `window-start'.
WINDOW must be a live window and defaults to the selected one.
This is updated by redisplay or by calling `set-window*-start'."
(if (functionp window-group-start-function)
(funcall window-group-start-function window)
(window-start window)))
(defvar window-group-end-function nil)
(make-variable-buffer-local 'window-group-end-function)
(put 'window-group-end-function 'permanent-local t)
(defun window-group-end (&optional window update)
"Return position at which display currently ends in the group of
windows containing WINDOW. When a grouping mode (such as Follow Mode)
is not active, this function is identical to `window-end'.
WINDOW must be a live window and defaults to the selected one.
This is updated by redisplay, when it runs to completion.
Simply changing the buffer text or setting `window-group-start'
does not update this value.
Return nil if there is no recorded value. (This can happen if the
last redisplay of WINDOW was preempted, and did not finish.)
If UPDATE is non-nil, compute the up-to-date position
if it isn't already recorded."
(if (functionp window-group-end-function)
(funcall window-group-end-function window update)
(window-end window update)))
(defvar set-window-group-start-function nil)
(make-variable-buffer-local 'set-window-group-start-function)
(put 'set-window-group-start-function 'permanent-local t)
(defun set-window-group-start (window pos &optional noforce)
"Make display in the group of windows containing WINDOW start at
position POS in WINDOW's buffer. When a grouping mode (such as Follow
Mode) is not active, this function is identical to `set-window-start'.
WINDOW must be a live window and defaults to the selected one. Return
POS. Optional third arg NOFORCE non-nil inhibits next redisplay from
overriding motion of point in order to display at this exact start."
(if (functionp set-window-group-start-function)
(funcall set-window-group-start-function window pos noforce)
(set-window-start window pos noforce)))
(defvar recenter-group-function nil)
(make-variable-buffer-local 'recenter-group-function)
(put 'recenter-group-function 'permanent-local t)
(defun recenter-group (&optional arg)
"Center point in the group of windows containing the selected window
and maybe redisplay frame. When a grouping mode (such as Follow Mode)
is not active, this function is identical to `recenter'.
With a numeric prefix argument ARG, recenter putting point on screen line ARG
relative to the first window in the selected window group. If ARG is
negative, it counts up from the bottom of the last window in the
group. (ARG should be less than the total height of the window group.)
If ARG is omitted or nil, then recenter with point on the middle line of
the selected window group; if the variable `recenter-redisplay' is
non-nil, also erase the entire frame and redraw it (when
`auto-resize-tool-bars' is set to `grow-only', this resets the
tool-bar's height to the minimum height needed); if
`recenter-redisplay' has the special value `tty', then only tty frames
are redrawn.
Just C-u as prefix means put point in the center of the window
and redisplay normally--don't erase and redraw the frame."
(if (functionp recenter-group-function)
(funcall recenter-group-function arg)
(recenter arg)))
(defvar pos-visible-in-window-group-p-function nil)
(make-variable-buffer-local 'pos-visible-in-window-group-p-function)
(put 'pos-visible-in-window-group-p-function 'permanent-local t)
(defun pos-visible-in-window-group-p (&optional pos window partially)
"Return non-nil if position POS is currently on the frame in the
window group containing WINDOW. When a grouping mode (such as Follow
Mode) is not active, this function is identical to
`pos-visible-in-window-p'.
WINDOW must be a live window and defaults to the selected one.
Return nil if that position is scrolled vertically out of view. If a
character is only partially visible, nil is returned, unless the
optional argument PARTIALLY is non-nil. If POS is only out of view
because of horizontal scrolling, return non-nil. If POS is t, it
specifies the position of the last visible glyph in the window group.
POS defaults to point in WINDOW; WINDOW defaults to the selected
window.
If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil,
the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]),
where X and Y are the pixel coordinates relative to the top left corner
of the window. The remaining elements are omitted if the character after
POS is fully visible; otherwise, RTOP and RBOT are the number of pixels
off-window at the top and bottom of the screen line (\"row\") containing
POS, ROWH is the visible height of that row, and VPOS is the row number
\(zero-based)."
(if (functionp pos-visible-in-window-group-p-function)
(funcall pos-visible-in-window-group-p-function pos window partially)
(pos-visible-in-window-p pos window partially)))
(defvar selected-window-group-function nil)
(make-variable-buffer-local 'selected-window-group-function)
(put 'selected-window-group-function 'permanent-local t)
(defun selected-window-group ()
"Return the list of windows in the group containing the selected window.
When a grouping mode (such as Follow Mode) is not active, the
result is a list containing only the selected window."
(if (functionp selected-window-group-function)
(funcall selected-window-group-function)
(list (selected-window))))
(defvar move-to-window-group-line-function nil)
(make-variable-buffer-local 'move-to-window-group-line-function)
(put 'move-to-window-group-line-function 'permanent-local t)
(defun move-to-window-group-line (arg)
"Position point relative to the the current group of windows.
When a grouping mode (such as Follow Mode) is not active, this
function is identical to `move-to-window-line'.
ARG nil means position point at center of the window group.
Else, ARG specifies the vertical position within the window
group; zero means top of first window in the group, negative
means relative to the bottom of the last window in the group."
(if (functionp move-to-window-group-line-function)
(funcall move-to-window-group-line-function arg)
(move-to-window-line arg)))
(defvar recenter-last-op nil
"Indicates the last recenter operation performed.
......
......@@ -10658,7 +10658,7 @@ The `posn-' functions access elements of such lists. */)
if (NILP (window))
window = selected_window;
tem = Fpos_visible_in_window_p (pos, window, Qt, Qnil);
tem = Fpos_visible_in_window_p (pos, window, Qt);
if (!NILP (tem))
{
Lisp_Object x = XCAR (tem);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment