From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: scroll-conservatively overflow Date: Fri, 16 Apr 2004 12:00:33 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <20040416114146.38AB.JMBARRANQUERO@wke.es> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1082109831 1399 80.91.224.253 (16 Apr 2004 10:03:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 16 Apr 2004 10:03:51 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 16 12:03:42 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BEQCE-00016q-00 for ; Fri, 16 Apr 2004 12:03:42 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BEQCD-00039v-00 for ; Fri, 16 Apr 2004 12:03:42 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BEQAT-0003J2-JV for emacs-devel@quimby.gnus.org; Fri, 16 Apr 2004 06:01:53 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BEQ9m-0003Ek-JX for emacs-devel@gnu.org; Fri, 16 Apr 2004 06:01:10 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BEQ9D-0002xl-A1 for emacs-devel@gnu.org; Fri, 16 Apr 2004 06:01:06 -0400 Original-Received: from [62.22.181.117] (helo=idefix.laley.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BEQ9C-0002xR-S3 for emacs-devel@gnu.org; Fri, 16 Apr 2004 06:00:35 -0400 Original-Received: from [172.17.221.23] (jsredondo.wk.org [172.17.221.23]) by idefix.laley.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2655.55) id 2HB1QW13; Fri, 16 Apr 2004 12:00:10 +0200 Original-To: emacs-devel@gnu.org X-Mailer: Becky! ver. 2.08.01 [en] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21741 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21741 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