unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
@ 2015-11-12 21:07 Juri Linkov
  2019-06-25 14:55 ` Lars Ingebrigtsen
  2019-09-29 21:40 ` Stefan Kangas
  0 siblings, 2 replies; 8+ messages in thread
From: Juri Linkov @ 2015-11-12 21:07 UTC (permalink / raw)
  To: 21893

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.

diff --git a/lisp/follow.el b/lisp/follow.el
index 938c59e..fa24a28 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -518,14 +518,14 @@ (defun follow-scroll-up (&optional arg)
 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))
 	(t
 	 (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
@@ -551,12 +551,12 @@ (defun follow-scroll-down (&optional arg)
 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))
 	(t
 	 (let ((opoint (point)))
-	   (scroll-down arg)
+	   (scroll-down-command arg)
 	   (unless (and scroll-preserve-screen-position
 			(get this-command 'scroll-command))
 	     (goto-char opoint))





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2015-11-12 21:07 bug#21893: 25.0.50; Using scroll-*-command in follow-mode Juri Linkov
@ 2019-06-25 14:55 ` Lars Ingebrigtsen
  2019-06-25 20:10   ` Juri Linkov
  2019-09-29 21:40 ` Stefan Kangas
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-06-25 14:55 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 21893

Juri Linkov <juri@linkov.net> writes:

> 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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2019-06-25 14:55 ` Lars Ingebrigtsen
@ 2019-06-25 20:10   ` Juri Linkov
  2019-07-04 21:01     ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2019-06-25 20:10 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, 21893

[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: follow-scroll-command.patch --]
[-- Type: text/x-diff, Size: 2642 bytes --]

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)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2019-06-25 20:10   ` Juri Linkov
@ 2019-07-04 21:01     ` Juri Linkov
  2019-07-05 18:44       ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2019-07-04 21:01 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Lars Ingebrigtsen, 21893

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

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?

Here is a better patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: follow-scroll-command.2.patch --]
[-- Type: text/x-diff, Size: 2719 bytes --]

diff --git a/lisp/follow.el b/lisp/follow.el
index acc2b26c55..faac87986b 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,13 +635,16 @@ 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))
-	       (signal 'end-of-buffer nil)
+	       (if (or (null scroll-error-top-bottom)
+		       (eobp))
+		   (signal 'end-of-buffer nil)
+		 (goto-char (point-max)))
 	     (select-window (car windows))
 	     ;; `window-end' might return nil.
 	     (if end
@@ -663,14 +666,17 @@ 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))
-	       (signal 'beginning-of-buffer nil)
+	       (if (or (null scroll-error-top-bottom)
+		       (bobp))
+		   (signal 'beginning-of-buffer nil)
+		 (goto-char (point-min)))
 	     (select-window win)
 	     (goto-char start)
 	     (vertical-motion (- (- (window-height win)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2019-07-04 21:01     ` Juri Linkov
@ 2019-07-05 18:44       ` Juri Linkov
  2019-07-05 19:25         ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Juri Linkov @ 2019-07-05 18:44 UTC (permalink / raw)
  To: 21893

>> 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?
>
> Here is a better patch:

The same problem of ignoring customization of scroll-error-top-bottom
exists in view-mode too, and this patch fixes it:

diff --git a/lisp/view.el b/lisp/view.el
index a765be02c1..e4489b391a 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -743,18 +743,19 @@ view-scroll-lines
     (setq backward (not backward) lines (- lines)))
   (when (and maxdefault lines (> lines (view-window-size)))
     (setq lines nil))
-  (cond (backward (scroll-down lines))
+  (cond (backward (scroll-down-command lines))
 	((view-really-at-end)
 	 (if view-scroll-auto-exit
 	     (View-quit)
 	   (ding)
 	   (view-end-message)))
-	(t (scroll-up lines)
+	(t (scroll-up-command lines)
 	   (if (view-really-at-end) (view-end-message)))))
 
 (defun view-really-at-end ()
   ;; Return true if buffer end visible.  Maybe revert buffer and test.
-  (and (pos-visible-in-window-p (point-max))
+  (and (or (null scroll-error-top-bottom) (eobp))
+       (pos-visible-in-window-p (point-max))
        (let ((buf (current-buffer))
 	     (bufname (buffer-name))
 	     (file (buffer-file-name)))


BTW, view-end-message is too verbose.  Shouldn't it verbosity be customizable?





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2019-07-05 18:44       ` Juri Linkov
@ 2019-07-05 19:25         ` Eli Zaretskii
  2019-07-07 22:36           ` Juri Linkov
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2019-07-05 19:25 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 21893

> From: Juri Linkov <juri@linkov.net>
> Date: Fri, 05 Jul 2019 21:44:52 +0300
> 
> BTW, view-end-message is too verbose.  Shouldn't it verbosity be customizable?

No, I don't think so.  It is not too verbose as it is, IMO.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2019-07-05 19:25         ` Eli Zaretskii
@ 2019-07-07 22:36           ` Juri Linkov
  0 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2019-07-07 22:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 21893

found 21893 25.0.50
fixed 21893 27.0.50
quit

>> BTW, view-end-message is too verbose.  Shouldn't it verbosity be customizable?
>
> No, I don't think so.  It is not too verbose as it is, IMO.

Ok, I just copied this function without messages to ~/.emacs
because it's very short to be customized conveniently.

So now after installing scroll-error-top-bottom handling to master,
I'm closing this report.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#21893: 25.0.50; Using scroll-*-command in follow-mode
  2015-11-12 21:07 bug#21893: 25.0.50; Using scroll-*-command in follow-mode Juri Linkov
  2019-06-25 14:55 ` Lars Ingebrigtsen
@ 2019-09-29 21:40 ` Stefan Kangas
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Kangas @ 2019-09-29 21:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 21893-done

Juri Linkov <juri@linkov.net> writes:

> So now after installing scroll-error-top-bottom handling to master,
> I'm closing this report.

Seems like this was left open by mistake; closing now.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-09-29 21:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-12 21:07 bug#21893: 25.0.50; Using scroll-*-command in follow-mode Juri Linkov
2019-06-25 14:55 ` Lars Ingebrigtsen
2019-06-25 20:10   ` Juri Linkov
2019-07-04 21:01     ` Juri Linkov
2019-07-05 18:44       ` Juri Linkov
2019-07-05 19:25         ` Eli Zaretskii
2019-07-07 22:36           ` Juri Linkov
2019-09-29 21:40 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).