diff options
| author | Alan Mackenzie | 2015-12-14 16:38:07 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2015-12-14 16:38:07 +0000 |
| commit | e8937de5547a687b6d03199368645f168cb8ad37 (patch) | |
| tree | 7b974d1ed2470576d1f7649a25b0a0af76eaf4c8 /lisp | |
| parent | 3194f1ccd99cfd13ddaf621d6e7f1e1aa1645165 (diff) | |
| download | emacs-e8937de5547a687b6d03199368645f168cb8ad37.tar.gz emacs-e8937de5547a687b6d03199368645f168cb8ad37.zip | |
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/follow.el | 20 | ||||
| -rw-r--r-- | lisp/isearch.el | 54 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 2 | ||||
| -rw-r--r-- | lisp/window.el | 157 |
4 files changed, 184 insertions, 49 deletions
diff --git a/lisp/follow.el b/lisp/follow.el index 609b29f7ccd..3a876bcb219 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -427,14 +427,14 @@ Keys specific to Follow mode: | |||
| 427 | (add-hook 'replace-update-post-hook 'follow-post-command-hook nil t) | 427 | (add-hook 'replace-update-post-hook 'follow-post-command-hook nil t) |
| 428 | (add-hook 'ispell-update-post-hook 'follow-post-command-hook nil t) | 428 | (add-hook 'ispell-update-post-hook 'follow-post-command-hook nil t) |
| 429 | 429 | ||
| 430 | (setq window-start-group-function 'follow-window-start) | 430 | (setq window-group-start-function 'follow-window-start) |
| 431 | (setq window-end-group-function 'follow-window-end) | 431 | (setq window-group-end-function 'follow-window-end) |
| 432 | (setq set-window-start-group-function 'follow-set-window-start) | 432 | (setq set-window-group-start-function 'follow-set-window-start) |
| 433 | (setq recenter-group-function 'follow-recenter) | 433 | (setq recenter-group-function 'follow-recenter) |
| 434 | (setq pos-visible-in-window-p-group-function | 434 | (setq pos-visible-in-window-group-p-function |
| 435 | 'follow-pos-visible-in-window-p) | 435 | 'follow-pos-visible-in-window-p) |
| 436 | (setq selected-window-group-function 'follow-all-followers) | 436 | (setq selected-window-group-function 'follow-all-followers) |
| 437 | (setq move-to-window-line-group-function 'follow-move-to-window-line)) | 437 | (setq move-to-window-group-line-function 'follow-move-to-window-line)) |
| 438 | 438 | ||
| 439 | ;; Remove globally-installed hook functions only if there is no | 439 | ;; Remove globally-installed hook functions only if there is no |
| 440 | ;; other Follow mode buffer. | 440 | ;; other Follow mode buffer. |
| @@ -447,13 +447,13 @@ Keys specific to Follow mode: | |||
| 447 | (remove-hook 'post-command-hook 'follow-post-command-hook) | 447 | (remove-hook 'post-command-hook 'follow-post-command-hook) |
| 448 | (remove-hook 'window-size-change-functions 'follow-window-size-change))) | 448 | (remove-hook 'window-size-change-functions 'follow-window-size-change))) |
| 449 | 449 | ||
| 450 | (kill-local-variable 'move-to-window-line-group-function) | 450 | (kill-local-variable 'move-to-window-group-line-function) |
| 451 | (kill-local-variable 'selected-window-group-function) | 451 | (kill-local-variable 'selected-window-group-function) |
| 452 | (kill-local-variable 'pos-visible-in-window-p-group-function) | 452 | (kill-local-variable 'pos-visible-in-window-group-p-function) |
| 453 | (kill-local-variable 'recenter-group-function) | 453 | (kill-local-variable 'recenter-group-function) |
| 454 | (kill-local-variable 'set-window-start-group-function) | 454 | (kill-local-variable 'set-window-group-start-function) |
| 455 | (kill-local-variable 'window-end-group-function) | 455 | (kill-local-variable 'window-group-end-function) |
| 456 | (kill-local-variable 'window-start-group-function) | 456 | (kill-local-variable 'window-group-start-function) |
| 457 | 457 | ||
| 458 | (remove-hook 'ispell-update-post-hook 'follow-post-command-hook t) | 458 | (remove-hook 'ispell-update-post-hook 'follow-post-command-hook t) |
| 459 | (remove-hook 'replace-update-post-hook 'follow-post-command-hook t) | 459 | (remove-hook 'replace-update-post-hook 'follow-post-command-hook t) |
diff --git a/lisp/isearch.el b/lisp/isearch.el index 8e9a686dca0..b29e432f37e 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el | |||
| @@ -982,7 +982,7 @@ The last thing is to trigger a new round of lazy highlighting." | |||
| 982 | (funcall (or isearch-message-function #'isearch-message))) | 982 | (funcall (or isearch-message-function #'isearch-message))) |
| 983 | (if (and isearch-slow-terminal-mode | 983 | (if (and isearch-slow-terminal-mode |
| 984 | (not (or isearch-small-window | 984 | (not (or isearch-small-window |
| 985 | (pos-visible-in-window-p nil nil nil t)))) | 985 | (pos-visible-in-window-group-p)))) |
| 986 | (let ((found-point (point))) | 986 | (let ((found-point (point))) |
| 987 | (setq isearch-small-window t) | 987 | (setq isearch-small-window t) |
| 988 | (move-to-window-line 0) | 988 | (move-to-window-line 0) |
| @@ -1003,10 +1003,10 @@ The last thing is to trigger a new round of lazy highlighting." | |||
| 1003 | (let ((current-scroll (window-hscroll)) | 1003 | (let ((current-scroll (window-hscroll)) |
| 1004 | visible-p) | 1004 | visible-p) |
| 1005 | (set-window-hscroll (selected-window) isearch-start-hscroll) | 1005 | (set-window-hscroll (selected-window) isearch-start-hscroll) |
| 1006 | (setq visible-p (pos-visible-in-window-p nil nil t t)) | 1006 | (setq visible-p (pos-visible-in-window-group-p nil nil t)) |
| 1007 | (if (or (not visible-p) | 1007 | (if (or (not visible-p) |
| 1008 | ;; When point is not visible because of hscroll, | 1008 | ;; When point is not visible because of hscroll, |
| 1009 | ;; pos-visible-in-window-p returns non-nil, but | 1009 | ;; pos-visible-in-window-group-p returns non-nil, but |
| 1010 | ;; the X coordinate it returns is 1 pixel beyond | 1010 | ;; the X coordinate it returns is 1 pixel beyond |
| 1011 | ;; the last visible one. | 1011 | ;; the last visible one. |
| 1012 | (>= (car visible-p) (window-body-width nil t))) | 1012 | (>= (car visible-p) (window-body-width nil t))) |
| @@ -1057,7 +1057,7 @@ NOPUSH is t and EDIT is t." | |||
| 1057 | (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) | 1057 | (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout) |
| 1058 | (isearch-dehighlight) | 1058 | (isearch-dehighlight) |
| 1059 | (lazy-highlight-cleanup lazy-highlight-cleanup) | 1059 | (lazy-highlight-cleanup lazy-highlight-cleanup) |
| 1060 | (let ((found-start (window-start nil t)) | 1060 | (let ((found-start (window-group-start)) |
| 1061 | (found-point (point))) | 1061 | (found-point (point))) |
| 1062 | (when isearch-window-configuration | 1062 | (when isearch-window-configuration |
| 1063 | (set-window-configuration isearch-window-configuration) | 1063 | (set-window-configuration isearch-window-configuration) |
| @@ -1067,7 +1067,7 @@ NOPUSH is t and EDIT is t." | |||
| 1067 | ;; This has an annoying side effect of clearing the last_modiff | 1067 | ;; This has an annoying side effect of clearing the last_modiff |
| 1068 | ;; field of the window, which can cause unwanted scrolling, | 1068 | ;; field of the window, which can cause unwanted scrolling, |
| 1069 | ;; so don't do it unless truly necessary. | 1069 | ;; so don't do it unless truly necessary. |
| 1070 | (set-window-start (selected-window) found-start t t)))) | 1070 | (set-window-group-start (selected-window) found-start t)))) |
| 1071 | 1071 | ||
| 1072 | (setq isearch-mode nil) | 1072 | (setq isearch-mode nil) |
| 1073 | (if isearch-input-method-local-p | 1073 | (if isearch-input-method-local-p |
| @@ -2279,12 +2279,12 @@ Return nil if it's completely visible, or if point is visible, | |||
| 2279 | together with as much of the search string as will fit; the symbol | 2279 | together with as much of the search string as will fit; the symbol |
| 2280 | `above' if we need to scroll the text downwards; the symbol `below', | 2280 | `above' if we need to scroll the text downwards; the symbol `below', |
| 2281 | if upwards." | 2281 | if upwards." |
| 2282 | (let ((w-start (window-start nil t)) | 2282 | (let ((w-start (window-group-start)) |
| 2283 | (w-end (window-end nil t t)) | 2283 | (w-end (window-group-end nil t)) |
| 2284 | (w-L1 (save-excursion | 2284 | (w-L1 (save-excursion |
| 2285 | (save-selected-window (move-to-window-line 1 t) (point)))) | 2285 | (save-selected-window (move-to-window-group-line 1) (point)))) |
| 2286 | (w-L-1 (save-excursion | 2286 | (w-L-1 (save-excursion |
| 2287 | (save-selected-window (move-to-window-line -1 t) (point)))) | 2287 | (save-selected-window (move-to-window-group-line -1) (point)))) |
| 2288 | start end) ; start and end of search string in buffer | 2288 | start end) ; start and end of search string in buffer |
| 2289 | (if isearch-forward | 2289 | (if isearch-forward |
| 2290 | (setq end isearch-point start (or isearch-other-end isearch-point)) | 2290 | (setq end isearch-point start (or isearch-other-end isearch-point)) |
| @@ -2311,15 +2311,15 @@ the bottom." | |||
| 2311 | (if above | 2311 | (if above |
| 2312 | (progn | 2312 | (progn |
| 2313 | (goto-char start) | 2313 | (goto-char start) |
| 2314 | (recenter 0 t) | 2314 | (recenter-group 0) |
| 2315 | (when (>= isearch-point (window-end nil t t)) | 2315 | (when (>= isearch-point (window-group-end nil t)) |
| 2316 | (goto-char isearch-point) | 2316 | (goto-char isearch-point) |
| 2317 | (recenter -1 t))) | 2317 | (recenter-group -1))) |
| 2318 | (goto-char end) | 2318 | (goto-char end) |
| 2319 | (recenter -1 t) | 2319 | (recenter-group -1) |
| 2320 | (when (< isearch-point (window-start nil t)) | 2320 | (when (< isearch-point (window-group-start)) |
| 2321 | (goto-char isearch-point) | 2321 | (goto-char isearch-point) |
| 2322 | (recenter 0 t)))) | 2322 | (recenter-group 0)))) |
| 2323 | (goto-char isearch-point)) | 2323 | (goto-char isearch-point)) |
| 2324 | 2324 | ||
| 2325 | (defvar isearch-pre-scroll-point nil) | 2325 | (defvar isearch-pre-scroll-point nil) |
| @@ -3090,9 +3090,9 @@ by other Emacs features." | |||
| 3090 | isearch-lax-whitespace)) | 3090 | isearch-lax-whitespace)) |
| 3091 | (not (eq isearch-lazy-highlight-regexp-lax-whitespace | 3091 | (not (eq isearch-lazy-highlight-regexp-lax-whitespace |
| 3092 | isearch-regexp-lax-whitespace)) | 3092 | isearch-regexp-lax-whitespace)) |
| 3093 | (not (= (window-start nil t) | 3093 | (not (= (window-group-start) |
| 3094 | isearch-lazy-highlight-window-start)) | 3094 | isearch-lazy-highlight-window-start)) |
| 3095 | (not (= (window-end nil nil t) ; Window may have been split/joined. | 3095 | (not (= (window-group-end) ; Window may have been split/joined. |
| 3096 | isearch-lazy-highlight-window-end)) | 3096 | isearch-lazy-highlight-window-end)) |
| 3097 | (not (eq isearch-forward | 3097 | (not (eq isearch-forward |
| 3098 | isearch-lazy-highlight-forward)) | 3098 | isearch-lazy-highlight-forward)) |
| @@ -3109,8 +3109,8 @@ by other Emacs features." | |||
| 3109 | isearch-lazy-highlight-end-limit end) | 3109 | isearch-lazy-highlight-end-limit end) |
| 3110 | (setq isearch-lazy-highlight-window (selected-window) | 3110 | (setq isearch-lazy-highlight-window (selected-window) |
| 3111 | isearch-lazy-highlight-window-group (selected-window-group) | 3111 | isearch-lazy-highlight-window-group (selected-window-group) |
| 3112 | isearch-lazy-highlight-window-start (window-start nil t) | 3112 | isearch-lazy-highlight-window-start (window-group-start) |
| 3113 | isearch-lazy-highlight-window-end (window-end nil nil t) | 3113 | isearch-lazy-highlight-window-end (window-group-end) |
| 3114 | ;; Start lazy-highlighting at the beginning of the found | 3114 | ;; Start lazy-highlighting at the beginning of the found |
| 3115 | ;; match (`isearch-other-end'). If no match, use point. | 3115 | ;; match (`isearch-other-end'). If no match, use point. |
| 3116 | ;; One of the next two variables (depending on search direction) | 3116 | ;; 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." | |||
| 3154 | (+ isearch-lazy-highlight-start | 3154 | (+ isearch-lazy-highlight-start |
| 3155 | ;; Extend bound to match whole string at point | 3155 | ;; Extend bound to match whole string at point |
| 3156 | (1- (length isearch-lazy-highlight-last-string))) | 3156 | (1- (length isearch-lazy-highlight-last-string))) |
| 3157 | (window-end nil nil t))) | 3157 | (window-group-end))) |
| 3158 | (max (or isearch-lazy-highlight-start-limit (point-min)) | 3158 | (max (or isearch-lazy-highlight-start-limit (point-min)) |
| 3159 | (if isearch-lazy-highlight-wrapped | 3159 | (if isearch-lazy-highlight-wrapped |
| 3160 | (- isearch-lazy-highlight-end | 3160 | (- isearch-lazy-highlight-end |
| 3161 | ;; Extend bound to match whole string at point | 3161 | ;; Extend bound to match whole string at point |
| 3162 | (1- (length isearch-lazy-highlight-last-string))) | 3162 | (1- (length isearch-lazy-highlight-last-string))) |
| 3163 | (window-start nil t)))))) | 3163 | (window-group-start)))))) |
| 3164 | ;; Use a loop like in `isearch-search'. | 3164 | ;; Use a loop like in `isearch-search'. |
| 3165 | (while retry | 3165 | (while retry |
| 3166 | (setq success (isearch-search-string | 3166 | (setq success (isearch-search-string |
| @@ -3204,12 +3204,12 @@ Attempt to do the search exactly the way the pending Isearch would." | |||
| 3204 | (if isearch-lazy-highlight-forward | 3204 | (if isearch-lazy-highlight-forward |
| 3205 | (if (= mb (if isearch-lazy-highlight-wrapped | 3205 | (if (= mb (if isearch-lazy-highlight-wrapped |
| 3206 | isearch-lazy-highlight-start | 3206 | isearch-lazy-highlight-start |
| 3207 | (window-end nil nil t))) | 3207 | (window-group-end))) |
| 3208 | (setq found nil) | 3208 | (setq found nil) |
| 3209 | (forward-char 1)) | 3209 | (forward-char 1)) |
| 3210 | (if (= mb (if isearch-lazy-highlight-wrapped | 3210 | (if (= mb (if isearch-lazy-highlight-wrapped |
| 3211 | isearch-lazy-highlight-end | 3211 | isearch-lazy-highlight-end |
| 3212 | (window-start nil t))) | 3212 | (window-group-start))) |
| 3213 | (setq found nil) | 3213 | (setq found nil) |
| 3214 | (forward-char -1))) | 3214 | (forward-char -1))) |
| 3215 | 3215 | ||
| @@ -3236,12 +3236,12 @@ Attempt to do the search exactly the way the pending Isearch would." | |||
| 3236 | (setq isearch-lazy-highlight-wrapped t) | 3236 | (setq isearch-lazy-highlight-wrapped t) |
| 3237 | (if isearch-lazy-highlight-forward | 3237 | (if isearch-lazy-highlight-forward |
| 3238 | (progn | 3238 | (progn |
| 3239 | (setq isearch-lazy-highlight-end (window-start nil t)) | 3239 | (setq isearch-lazy-highlight-end (window-group-start)) |
| 3240 | (goto-char (max (or isearch-lazy-highlight-start-limit (point-min)) | 3240 | (goto-char (max (or isearch-lazy-highlight-start-limit (point-min)) |
| 3241 | (window-start nil t)))) | 3241 | (window-group-start)))) |
| 3242 | (setq isearch-lazy-highlight-start (window-end nil nil t)) | 3242 | (setq isearch-lazy-highlight-start (window-group-end)) |
| 3243 | (goto-char (min (or isearch-lazy-highlight-end-limit (point-max)) | 3243 | (goto-char (min (or isearch-lazy-highlight-end-limit (point-max)) |
| 3244 | (window-end nil nil t)))))))) | 3244 | (window-group-end)))))))) |
| 3245 | (unless nomore | 3245 | (unless nomore |
| 3246 | (setq isearch-lazy-highlight-timer | 3246 | (setq isearch-lazy-highlight-timer |
| 3247 | (run-at-time lazy-highlight-interval nil | 3247 | (run-at-time lazy-highlight-interval nil |
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 7d5bb6dbc59..0f1806c8888 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -2323,7 +2323,7 @@ Global `ispell-quit' set to start location to continue spell session." | |||
| 2323 | (run-hooks 'ispell-update-post-hook) | 2323 | (run-hooks 'ispell-update-post-hook) |
| 2324 | 2324 | ||
| 2325 | ;; ensure word is visible | 2325 | ;; ensure word is visible |
| 2326 | (if (not (pos-visible-in-window-p end nil nil t)) | 2326 | (if (not (pos-visible-in-window-group-p end)) |
| 2327 | (sit-for 0)) | 2327 | (sit-for 0)) |
| 2328 | 2328 | ||
| 2329 | ;; Display choices for misspelled word. | 2329 | ;; Display choices for misspelled word. |
diff --git a/lisp/window.el b/lisp/window.el index c5a1019372c..ce0256f1fff 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -28,17 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | ;;; Code: | 29 | ;;; Code: |
| 30 | 30 | ||
| 31 | (defvar selected-window-group-function nil) | ||
| 32 | (make-variable-buffer-local 'selected-window-group-function) | ||
| 33 | (put 'selected-window-group-function 'permanent-local t) | ||
| 34 | (defun selected-window-group () | ||
| 35 | "Return the list of windows in the group containing the selected window. | ||
| 36 | When a grouping mode (such as Follow Mode) is not active, the | ||
| 37 | result is a list containing only the selected window." | ||
| 38 | (if (functionp selected-window-group-function) | ||
| 39 | (funcall selected-window-group-function) | ||
| 40 | (list (selected-window)))) | ||
| 41 | |||
| 42 | (defun internal--before-save-selected-window () | 31 | (defun internal--before-save-selected-window () |
| 43 | (cons (selected-window) | 32 | (cons (selected-window) |
| 44 | ;; We save and restore all frames' selected windows, because | 33 | ;; We save and restore all frames' selected windows, because |
| @@ -7881,6 +7870,152 @@ Return non-nil if the window was shrunk, nil otherwise." | |||
| 7881 | (remove-hook 'kill-buffer-hook delete-window-hook t)))))) | 7870 | (remove-hook 'kill-buffer-hook delete-window-hook t)))))) |
| 7882 | 7871 | ||
| 7883 | 7872 | ||
| 7873 | ;;; | ||
| 7874 | ;; Groups of windows (Follow Mode). | ||
| 7875 | ;; | ||
| 7876 | ;; This section of functions extends the functionality of some window | ||
| 7877 | ;; manipulating commands to groups of windows co-operatively | ||
| 7878 | ;; displaying a buffer, typically with Follow Mode. | ||
| 7879 | ;; | ||
| 7880 | ;; The xxx-function variables are permanent locals so that their local | ||
| 7881 | ;; status is undone only when explicitly programmed, not when a buffer | ||
| 7882 | ;; is reverted or a mode function is called. | ||
| 7883 | |||
| 7884 | (defvar window-group-start-function nil) | ||
| 7885 | (make-variable-buffer-local 'window-group-start-function) | ||
| 7886 | (put 'window-group-start-function 'permanent-local t) | ||
| 7887 | (defun window-group-start (&optional window) | ||
| 7888 | "Return position at which display currently starts in the group of | ||
| 7889 | windows containing WINDOW. When a grouping mode (such as Follow Mode) | ||
| 7890 | is not active, this function is identical to `window-start'. | ||
| 7891 | |||
| 7892 | WINDOW must be a live window and defaults to the selected one. | ||
| 7893 | This is updated by redisplay or by calling `set-window*-start'." | ||
| 7894 | (if (functionp window-group-start-function) | ||
| 7895 | (funcall window-group-start-function window) | ||
| 7896 | (window-start window))) | ||
| 7897 | |||
| 7898 | (defvar window-group-end-function nil) | ||
| 7899 | (make-variable-buffer-local 'window-group-end-function) | ||
| 7900 | (put 'window-group-end-function 'permanent-local t) | ||
| 7901 | (defun window-group-end (&optional window update) | ||
| 7902 | "Return position at which display currently ends in the group of | ||
| 7903 | windows containing WINDOW. When a grouping mode (such as Follow Mode) | ||
| 7904 | is not active, this function is identical to `window-end'. | ||
| 7905 | |||
| 7906 | WINDOW must be a live window and defaults to the selected one. | ||
| 7907 | This is updated by redisplay, when it runs to completion. | ||
| 7908 | Simply changing the buffer text or setting `window-group-start' | ||
| 7909 | does not update this value. | ||
| 7910 | Return nil if there is no recorded value. (This can happen if the | ||
| 7911 | last redisplay of WINDOW was preempted, and did not finish.) | ||
| 7912 | If UPDATE is non-nil, compute the up-to-date position | ||
| 7913 | if it isn't already recorded." | ||
| 7914 | (if (functionp window-group-end-function) | ||
| 7915 | (funcall window-group-end-function window update) | ||
| 7916 | (window-end window update))) | ||
| 7917 | |||
| 7918 | (defvar set-window-group-start-function nil) | ||
| 7919 | (make-variable-buffer-local 'set-window-group-start-function) | ||
| 7920 | (put 'set-window-group-start-function 'permanent-local t) | ||
| 7921 | (defun set-window-group-start (window pos &optional noforce) | ||
| 7922 | "Make display in the group of windows containing WINDOW start at | ||
| 7923 | position POS in WINDOW's buffer. When a grouping mode (such as Follow | ||
| 7924 | Mode) is not active, this function is identical to `set-window-start'. | ||
| 7925 | |||
| 7926 | WINDOW must be a live window and defaults to the selected one. Return | ||
| 7927 | POS. Optional third arg NOFORCE non-nil inhibits next redisplay from | ||
| 7928 | overriding motion of point in order to display at this exact start." | ||
| 7929 | (if (functionp set-window-group-start-function) | ||
| 7930 | (funcall set-window-group-start-function window pos noforce) | ||
| 7931 | (set-window-start window pos noforce))) | ||
| 7932 | |||
| 7933 | (defvar recenter-group-function nil) | ||
| 7934 | (make-variable-buffer-local 'recenter-group-function) | ||
| 7935 | (put 'recenter-group-function 'permanent-local t) | ||
| 7936 | (defun recenter-group (&optional arg) | ||
| 7937 | "Center point in the group of windows containing the selected window | ||
| 7938 | and maybe redisplay frame. When a grouping mode (such as Follow Mode) | ||
| 7939 | is not active, this function is identical to `recenter'. | ||
| 7940 | |||
| 7941 | With a numeric prefix argument ARG, recenter putting point on screen line ARG | ||
| 7942 | relative to the first window in the selected window group. If ARG is | ||
| 7943 | negative, it counts up from the bottom of the last window in the | ||
| 7944 | group. (ARG should be less than the total height of the window group.) | ||
| 7945 | |||
| 7946 | If ARG is omitted or nil, then recenter with point on the middle line of | ||
| 7947 | the selected window group; if the variable `recenter-redisplay' is | ||
| 7948 | non-nil, also erase the entire frame and redraw it (when | ||
| 7949 | `auto-resize-tool-bars' is set to `grow-only', this resets the | ||
| 7950 | tool-bar's height to the minimum height needed); if | ||
| 7951 | `recenter-redisplay' has the special value `tty', then only tty frames | ||
| 7952 | are redrawn. | ||
| 7953 | |||
| 7954 | Just C-u as prefix means put point in the center of the window | ||
| 7955 | and redisplay normally--don't erase and redraw the frame." | ||
| 7956 | (if (functionp recenter-group-function) | ||
| 7957 | (funcall recenter-group-function arg) | ||
| 7958 | (recenter arg))) | ||
| 7959 | |||
| 7960 | (defvar pos-visible-in-window-group-p-function nil) | ||
| 7961 | (make-variable-buffer-local 'pos-visible-in-window-group-p-function) | ||
| 7962 | (put 'pos-visible-in-window-group-p-function 'permanent-local t) | ||
| 7963 | (defun pos-visible-in-window-group-p (&optional pos window partially) | ||
| 7964 | "Return non-nil if position POS is currently on the frame in the | ||
| 7965 | window group containing WINDOW. When a grouping mode (such as Follow | ||
| 7966 | Mode) is not active, this function is identical to | ||
| 7967 | `pos-visible-in-window-p'. | ||
| 7968 | |||
| 7969 | WINDOW must be a live window and defaults to the selected one. | ||
| 7970 | |||
| 7971 | Return nil if that position is scrolled vertically out of view. If a | ||
| 7972 | character is only partially visible, nil is returned, unless the | ||
| 7973 | optional argument PARTIALLY is non-nil. If POS is only out of view | ||
| 7974 | because of horizontal scrolling, return non-nil. If POS is t, it | ||
| 7975 | specifies the position of the last visible glyph in the window group. | ||
| 7976 | POS defaults to point in WINDOW; WINDOW defaults to the selected | ||
| 7977 | window. | ||
| 7978 | |||
| 7979 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | ||
| 7980 | the return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | ||
| 7981 | where X and Y are the pixel coordinates relative to the top left corner | ||
| 7982 | of the window. The remaining elements are omitted if the character after | ||
| 7983 | POS is fully visible; otherwise, RTOP and RBOT are the number of pixels | ||
| 7984 | off-window at the top and bottom of the screen line (\"row\") containing | ||
| 7985 | POS, ROWH is the visible height of that row, and VPOS is the row number | ||
| 7986 | \(zero-based)." | ||
| 7987 | (if (functionp pos-visible-in-window-group-p-function) | ||
| 7988 | (funcall pos-visible-in-window-group-p-function pos window partially) | ||
| 7989 | (pos-visible-in-window-p pos window partially))) | ||
| 7990 | |||
| 7991 | (defvar selected-window-group-function nil) | ||
| 7992 | (make-variable-buffer-local 'selected-window-group-function) | ||
| 7993 | (put 'selected-window-group-function 'permanent-local t) | ||
| 7994 | (defun selected-window-group () | ||
| 7995 | "Return the list of windows in the group containing the selected window. | ||
| 7996 | When a grouping mode (such as Follow Mode) is not active, the | ||
| 7997 | result is a list containing only the selected window." | ||
| 7998 | (if (functionp selected-window-group-function) | ||
| 7999 | (funcall selected-window-group-function) | ||
| 8000 | (list (selected-window)))) | ||
| 8001 | |||
| 8002 | (defvar move-to-window-group-line-function nil) | ||
| 8003 | (make-variable-buffer-local 'move-to-window-group-line-function) | ||
| 8004 | (put 'move-to-window-group-line-function 'permanent-local t) | ||
| 8005 | (defun move-to-window-group-line (arg) | ||
| 8006 | "Position point relative to the the current group of windows. | ||
| 8007 | When a grouping mode (such as Follow Mode) is not active, this | ||
| 8008 | function is identical to `move-to-window-line'. | ||
| 8009 | |||
| 8010 | ARG nil means position point at center of the window group. | ||
| 8011 | Else, ARG specifies the vertical position within the window | ||
| 8012 | group; zero means top of first window in the group, negative | ||
| 8013 | means relative to the bottom of the last window in the group." | ||
| 8014 | (if (functionp move-to-window-group-line-function) | ||
| 8015 | (funcall move-to-window-group-line-function arg) | ||
| 8016 | (move-to-window-line arg))) | ||
| 8017 | |||
| 8018 | |||
| 7884 | (defvar recenter-last-op nil | 8019 | (defvar recenter-last-op nil |
| 7885 | "Indicates the last recenter operation performed. | 8020 | "Indicates the last recenter operation performed. |
| 7886 | Possible values: `top', `middle', `bottom', integer or float numbers. | 8021 | Possible values: `top', `middle', `bottom', integer or float numbers. |