bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21893: 25.0.50; Using scroll-*-command in follow-mode


From: Juri Linkov
Subject: bug#21893: 25.0.50; Using scroll-*-command in follow-mode
Date: Tue, 25 Jun 2019 23:10:50 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

Hello, Alan.

Lars reminded me of this old report that tries to add support for
a non-nil value of scroll-error-top-bottom for scrolling in follow-mode.

Now I updated the patch for the current master.
Do you think this is the right fix?

>> follow.el could use better commands scroll-up-command/scroll-down-command
>> like in this patch to work smoothly when scroll-error-top-bottom is t,
>> but a special condition in follow-scroll-up/follow-scroll-down
>> that checks for scroll-preserve-screen-position prevents from scrolling
>> and returns point to the old position, and there is no comment
>> explaining this special-casing.
>
> [...]
>
>> -     (scroll-up arg))
>> +     (scroll-up-command arg))
>
> Your patch basically replaces some of the calls to scroll-{up,down} with
> scroll-{up/down}-command, which I think makes sense, since this is
> supposed to emulate the normal scroll up/down commands, as far as I can
> tell.
>
> But the patch no longer applies, and I don't use follow mode.  Could a
> follow mode user say whether this is what they'd expect, and if so, spin
> a new patch?

diff --git a/lisp/follow.el b/lisp/follow.el
index acc2b26c55..4269bf7cb1 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -557,7 +557,7 @@ follow-scroll-up-arg
   (let ((opoint (point))  (owin (selected-window)))
     (while
         ;; If we are too near EOB, try scrolling the previous window.
-        (condition-case nil (progn (scroll-up arg) nil)
+        (condition-case nil (progn (scroll-up-command arg) nil)
           (end-of-buffer
            (condition-case nil (progn (follow-previous-window) t)
              (error
@@ -576,7 +576,7 @@ follow-scroll-down-arg
 This is an internal function for `follow-scroll-down' and
 `follow-scroll-down-window'."
   (let ((opoint (point)))
-    (scroll-down arg)
+    (scroll-down-command arg)
     (unless (and scroll-preserve-screen-position
                  (get this-command 'scroll-command))
       (goto-char opoint))
@@ -596,7 +596,7 @@ follow-scroll-up-window
 Works like `scroll-up' when not in Follow mode."
   (interactive "P")
   (cond ((not follow-mode)
-        (scroll-up arg))
+        (scroll-up-command arg))
        ((eq arg '-)
         (follow-scroll-down-window))
        (t (follow-scroll-up-arg arg))))
@@ -616,7 +616,7 @@ follow-scroll-down-window
 Works like `scroll-down' when not in Follow mode."
   (interactive "P")
   (cond ((not follow-mode)
-        (scroll-down arg))
+        (scroll-down-command arg))
        ((eq arg '-)
         (follow-scroll-up-window))
        (t (follow-scroll-down-arg arg))))
@@ -635,12 +635,14 @@ follow-scroll-up
 Works like `scroll-up' when not in Follow mode."
   (interactive "P")
   (cond ((not follow-mode)
-        (scroll-up arg))
+        (scroll-up-command arg))
        (arg (follow-scroll-up-arg arg))
         (t
         (let* ((windows (follow-all-followers))
                (end (window-end (car (reverse windows)))))
-          (if (eq end (point-max))
+          (if (and (eq end (point-max))
+                    (or (null scroll-error-top-bottom)
+                        (eobp)))
               (signal 'end-of-buffer nil)
             (select-window (car windows))
             ;; `window-end' might return nil.
@@ -663,13 +665,15 @@ follow-scroll-down
 Works like `scroll-down' when not in Follow mode."
   (interactive "P")
   (cond ((not follow-mode)
-        (scroll-down arg))
+        (scroll-down-command arg))
        (arg (follow-scroll-down-arg arg))
         (t
         (let* ((windows (follow-all-followers))
                (win (car (reverse windows)))
                (start (window-start (car windows))))
-          (if (eq start (point-min))
+          (if (and (eq start (point-min))
+                    (or (null scroll-error-top-bottom)
+                        (bobp)))
               (signal 'beginning-of-buffer nil)
             (select-window win)
             (goto-char start)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]