unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <jmbarranquero@wke.es>
Subject: scroll-conservatively overflow
Date: Fri, 16 Apr 2004 12:00:33 +0200	[thread overview]
Message-ID: <20040416114146.38AB.JMBARRANQUERO@wke.es> (raw)


I like scrolling one line at a time. I have

(setq scroll-step 0
      scroll-conservatively most-positive-fixnum)

on my .emacs because scroll-step's documentation recommends setting
scroll-conservatively to "a large value" and most-positive-fixnum seems
less arbitrary than 10000 or 65535 or whatever.

That used to work; now it doesn't (although I'm not sure it is because
of a recent change or I just took a time to notice), because
scroll-conservatively gets multiplied by FRAME_LINE_HEIGHT (f) in a
couple of places, and that causes an overflow.

I have two options: either cutting scroll-conservatively down to a
manageable size before any use of it, or patching the docstring for
scroll-step to say that a large, but *reasonable*, value should be used.

I favor patching try_scrolling, because I don't even want to think how
to describe "a reasonable value" on the docstring :) and because we should
protect against unintended overflows like this one (the users can have
set scroll-conservatively to a big value on their .emacs and would get
wrong behaviour when switching to 21.X, X > 3).

So, if no one opposes, I'll install the attached patch.

                                                                Juanma



--- xdisp.c.orig	2004-04-14 22:33:44.000000000 +0200
+++ xdisp.c	2004-04-16 11:39:38.000000000 +0200
@@ -10881,2 +10881,8 @@
 
+  /* Force scroll_conservatively to have a reasonable value so it doesn't cause
+     an overflow while computing how much to scroll.  */
+  if (scroll_conservatively)
+      scroll_conservatively = min (scroll_conservatively,
+                                   MOST_POSITIVE_FIXNUM / FRAME_LINE_HEIGHT (f));
+
   /* Compute how much we should try to scroll maximally to bring point

             reply	other threads:[~2004-04-16 10:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-16 10:00 Juanma Barranquero [this message]
2004-04-16 13:17 ` scroll-conservatively overflow Kim F. Storm
2004-04-16 14:03   ` Romain Francoise
2004-04-30 11:35     ` Romain Francoise
2004-04-30 16:38       ` Kim F. Storm
2004-05-01 17:50       ` Richard Stallman
2004-05-02 12:37         ` Romain Francoise
2004-05-02 16:58           ` Stefan Monnier
2004-05-03 14:03           ` Richard Stallman
2004-04-17 19:42   ` Richard Stallman
2004-04-17 20:52     ` Juanma Barranquero
2004-04-18 21:31       ` Kim F. Storm
2004-04-19 11:37       ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20040416114146.38AB.JMBARRANQUERO@wke.es \
    --to=jmbarranquero@wke.es \
    /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 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).