all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xie Shynur <one.last.kiss@outlook.com>
To: 62530@debbugs.gnu.org
Subject: bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step
Date: Wed, 29 Mar 2023 17:47:44 +0000	[thread overview]
Message-ID: <SA0PR04MB7433CD91E94185002FFCAA56D7899@SA0PR04MB7433.namprd04.prod.outlook.com> (raw)

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


             reply	other threads:[~2023-03-29 17:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 17:47 Xie Shynur [this message]
2023-03-30  6:45 ` bug#62530: [PATCH] Fix the case that scroll-conservatively is overridden by scroll-step Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA0PR04MB7433CD91E94185002FFCAA56D7899@SA0PR04MB7433.namprd04.prod.outlook.com \
    --to=one.last.kiss@outlook.com \
    --cc=62530@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.