diff options
| -rw-r--r-- | lisp/follow.el | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/lisp/follow.el b/lisp/follow.el index 7af3a049299..65015c5dd86 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -1033,21 +1033,27 @@ Note that this handles the case when the cache has been set to nil." | |||
| 1033 | (defun follow-select-if-visible (dest win-start-end) | 1033 | (defun follow-select-if-visible (dest win-start-end) |
| 1034 | "Select and return a window, if DEST is visible in it. | 1034 | "Select and return a window, if DEST is visible in it. |
| 1035 | Return the selected window." | 1035 | Return the selected window." |
| 1036 | (let (win) | 1036 | (let (win win-end) |
| 1037 | (while (and (not win) win-start-end) | 1037 | (while (and (not win) win-start-end) |
| 1038 | ;; Don't select a window that was just moved. This makes it | 1038 | ;; Don't select a window that was just moved. This makes it |
| 1039 | ;; possible to later select the last window after a `end-of-buffer' | 1039 | ;; possible to later select the last window after a `end-of-buffer' |
| 1040 | ;; command. | 1040 | ;; command. |
| 1041 | (when (follow-pos-visible dest (caar win-start-end) win-start-end) | 1041 | (when (follow-pos-visible dest (caar win-start-end) win-start-end) |
| 1042 | (setq win (caar win-start-end)) | 1042 | (setq win (caar win-start-end) |
| 1043 | win-end (car (cddr (car win-start-end)))) | ||
| 1043 | (select-window win)) | 1044 | (select-window win)) |
| 1044 | (setq win-start-end (cdr win-start-end))) | 1045 | (setq win-start-end (cdr win-start-end))) |
| 1045 | ;; The last line of the window may be partially visible; if so, | 1046 | ;; The last line of the window may be partially visible; if so, |
| 1046 | ;; and if point is visible in the next window, select the next | 1047 | ;; and if point is visible in the next window, select the next |
| 1047 | ;; window instead. | 1048 | ;; window instead. |
| 1048 | (and (/= dest (point-max)) | 1049 | (and win |
| 1050 | (/= dest (point-max)) | ||
| 1049 | win-start-end | 1051 | win-start-end |
| 1050 | (follow-pos-visible dest (caar win-start-end) win-start-end) | 1052 | (follow-pos-visible dest (caar win-start-end) win-start-end) |
| 1053 | (save-excursion | ||
| 1054 | (goto-char dest) | ||
| 1055 | (vertical-motion 1 win) | ||
| 1056 | (>= (point) win-end)) | ||
| 1051 | (setq win (caar win-start-end)) | 1057 | (setq win (caar win-start-end)) |
| 1052 | (select-window win)) | 1058 | (select-window win)) |
| 1053 | win)) | 1059 | win)) |
| @@ -1373,13 +1379,13 @@ non-first windows in Follow mode." | |||
| 1373 | ((and visible aligned) | 1379 | ((and visible aligned) |
| 1374 | (follow-debug-message "same")) | 1380 | (follow-debug-message "same")) |
| 1375 | ;; Pick a position in any window. If the display is | 1381 | ;; Pick a position in any window. If the display is |
| 1376 | ;; ok, this will pick the `correct' window. If the | 1382 | ;; ok, this will pick the `correct' window. |
| 1377 | ;; display is wierd (e.g., after a delete at the | ||
| 1378 | ;; beginning of the window) do this anyway. | ||
| 1379 | ((follow-select-if-visible dest win-start-end) | 1383 | ((follow-select-if-visible dest win-start-end) |
| 1380 | (follow-debug-message "visible") | 1384 | (follow-debug-message "visible") |
| 1381 | (setq visible t) | 1385 | (goto-char dest) |
| 1382 | (goto-char dest)) | 1386 | ;; We have to perform redisplay, since scrolling is |
| 1387 | ;; needed in case the line is partially visible. | ||
| 1388 | (setq visible nil)) | ||
| 1383 | ;; Not visible anywhere else, lets pick this one. | 1389 | ;; Not visible anywhere else, lets pick this one. |
| 1384 | ;; (Is this case used?) | 1390 | ;; (Is this case used?) |
| 1385 | (visible | 1391 | (visible |
| @@ -1411,16 +1417,10 @@ non-first windows in Follow mode." | |||
| 1411 | (let ((p (window-point win))) | 1417 | (let ((p (window-point win))) |
| 1412 | (set-window-start win (window-start win) nil) | 1418 | (set-window-start win (window-start win) nil) |
| 1413 | (set-window-point win p)))) | 1419 | (set-window-point win p)))) |
| 1414 | (unless (or visible | 1420 | (unless visible |
| 1415 | ;; Use the UPDATE argument of window-end | 1421 | ;; If point may not be visible in the selected window, |
| 1416 | ;; instead of calling follow-pos-visible | 1422 | ;; perform a redisplay; this ensures scrolling. |
| 1417 | ;; (which may be inaccurate for partially | 1423 | (redisplay) |
| 1418 | ;; visible lines). | ||
| 1419 | (and (>= dest (window-start)) | ||
| 1420 | (< dest (window-end nil t)))) | ||
| 1421 | ;; If point is not visible in the selected window, | ||
| 1422 | ;; perform a redisplay; this causes scrolling. | ||
| 1423 | (sit-for 0) | ||
| 1424 | (setq selected-window-up-to-date t) | 1424 | (setq selected-window-up-to-date t) |
| 1425 | (follow-avoid-tail-recenter) | 1425 | (follow-avoid-tail-recenter) |
| 1426 | (setq win-start-end (follow-windows-start-end windows)) | 1426 | (setq win-start-end (follow-windows-start-end windows)) |