[Top][All Lists]

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

scroll-conservatively overflow

From: Juanma Barranquero
Subject: scroll-conservatively overflow
Date: Fri, 16 Apr 2004 12:00:33 +0200

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.


--- 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 
   /* Compute how much we should try to scroll maximally to bring point

reply via email to

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