all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step
@ 2023-03-29 17:47 Xie Shynur
  2023-03-30  6:45 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Xie Shynur @ 2023-03-29 17:47 UTC (permalink / raw)
  To: 62530

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

GNU Emacs Manual, 14.3 Automatic Scrolling:

> In case you customize multiple variables, the order of priority is: `scroll-conservatively`, then `scroll-step`, ...

It works for `next-line`, BUT ignores `previous-line`.

_____________________________________

Say evaluate the following Lisp code:

```
(setq scroll-conservatively 101)
(setq scroll-step 5)
```

Then, when calling `previous-line` which will lead to auto-scrolling,
it acts like that `scroll-conservatively` is not set,
i.e., Emacs will scroll 5 lines.

This PATCH fixes the BUG.

[-- Attachment #2: 0001-scroll-conservatively-is-overriden-by-scroll-step.patch --]
[-- Type: application/octet-stream, Size: 1436 bytes --]

From ef23393d6bc354997d1f75219eb83beb97d38442 Mon Sep 17 00:00:00 2001
From: Shynur <one.last.kiss@outlook.com>
Date: Thu, 30 Mar 2023 01:29:17 +0800
Subject: [PATCH] scroll-conservatively is overriden by scroll-step

GNU Emacs Manual, 14.3 Automatic Scrolling:

> In case you customize multiple variables, the order of priority is: `scroll-conservatively`, then `scroll-step`, ...

It works for `next-line`, BUT ignores `previous-line`.

_____________________________________

Say evaluate the following Lisp code:

```
(setq scroll-conservatively 101)
(setq scroll-step 5)
```

Then, when calling `previous-line` which will lead to auto-scrolling,
it acts like that `scroll-conservatively` is not set,
i.e., Emacs will scroll 5 lines.

This PATCH fixes the BUG.
---
 src/xdisp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 754a7c16c76..76d6592bf00 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -18546,8 +18546,9 @@ try_scrolling (Lisp_Object window, bool just_this_one_p,
 	  start_display (&it, w, startp);
 
 	  if (arg_scroll_conservatively)
-	    amount_to_scroll = max (dy, frame_line_height
-				    * max (scroll_step, temp_scroll_step));
+	    amount_to_scroll
+	      = min (max (dy, frame_line_height),
+		     frame_line_height * arg_scroll_conservatively);
 	  else if (scroll_step || temp_scroll_step)
 	    amount_to_scroll = scroll_max;
 	  else
-- 
2.34.1


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

* bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step
  2023-03-29 17:47 bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step Xie Shynur
@ 2023-03-30  6:45 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-03-30  6:45 UTC (permalink / raw)
  To: Xie Shynur; +Cc: 62530-done

> From: Xie Shynur <one.last.kiss@outlook.com>
> Date: Wed, 29 Mar 2023 17:47:44 +0000
> msip_labels: 
> 
> GNU Emacs Manual, 14.3 Automatic Scrolling:
> 
> > In case you customize multiple variables, the order of priority is: `scroll-conservatively`, then `scroll-step`, ...
> 
> It works for `next-line`, BUT ignores `previous-line`.
> 
> _____________________________________
> 
> Say evaluate the following Lisp code:
> 
> ```
> (setq scroll-conservatively 101)
> (setq scroll-step 5)
> ```
> 
> Then, when calling `previous-line` which will lead to auto-scrolling,
> it acts like that `scroll-conservatively` is not set,
> i.e., Emacs will scroll 5 lines.
> 
> This PATCH fixes the BUG.

Thanks, installed on the emacs-29 branch, and closing the bug.





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

end of thread, other threads:[~2023-03-30  6:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 17:47 bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step Xie Shynur
2023-03-30  6:45 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.