From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Hanak David Newsgroups: gmane.emacs.bugs Subject: Buggy scroll-up (was: scroll-margin buggy on Emacs 21.1) Date: Sun, 15 Jun 2003 12:06:00 +0200 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <3C7D593F.9080906@nnl.se> <8361-Sun03Mar2002190054+0200-eliz@is.elta.co.il> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: main.gmane.org 1055704259 6755 80.91.224.249 (15 Jun 2003 19:10:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 15 Jun 2003 19:10:59 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 15 21:10:55 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19RctS-0001i1-00 for ; Sun, 15 Jun 2003 21:10:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Rcvm-0000OG-RE for gnu-bug-gnu-emacs@m.gmane.org; Sun, 15 Jun 2003 15:12:46 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19RcvF-0007tE-RP for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2003 15:12:13 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19RcuQ-00073q-L4 for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2003 15:11:23 -0400 Original-Received: from mail.vnet.hu ([213.163.59.4] helo=vadangyal.vnet.hu) by monty-python.gnu.org with esmtp (Exim 4.20) id 19RcuA-0006le-Tm for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2003 15:11:07 -0400 Original-Path: quimby.gnus.org!not-for-mail Original-Received: from maui.hanak.hu (adsl242216.vnet.hu [62.77.242.216]) by mail.vnet.hu (iPlanet Messaging Server 5.1 Patch 1 (built Jun 6 2002)) with ESMTPA id <0HGJ00IMLEMAB4@mail.vnet.hu> for bug-gnu-emacs@gnu.org; Sun, 15 Jun 2003 21:10:59 +0200 (CEST) Original-Received: by maui.hanak.hu (Postfix, from userid 501) id 78E51B2; Sun, 15 Jun 2003 21:10:56 +0200 (CEST) Original-X-Trace: quimby.gnus.org 1055672816 28140 62.77.242.216 (15 Jun 2003 10:26:56 GMT) Resent-date: Sun, 15 Jun 2003 21:10:56 +0200 Resent-from: Hanak David Resent-to: bug-gnu-emacs@gnu.org Resent-message-id: <20030615191056.78E51B2@maui.hanak.hu> Original-X-Complaints-to: usenet@quimby.gnus.org Original-NNTP-posting-date: 15 Jun 2003 10:26:56 GMT Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAwBAMAAACRVSWoAAAAGFBMVEWNZFgtIyTy9fEjGhx0 UUdMNjKajYXCxsNbs5ZQAAAByElEQVR4nG3SwY7bIBAGYFqR9NqRQ8+rSI3PiBcgKuxeiwQ5p6td cl1ZqXn9/jPYiluVHGx/mpkfE6vjuk5Tv453UqvN9xzqq+DQca4qJhrITONx/OiVp2uiRM65cpmB vfL+Tryco+KnpXJEK1mudM6sKHUWOkD3HUdEWH52PMG0K+MT7q111jlLg7MXwe/Yy1I54PJV8B33 Vpjb3aEyRpIibuUJh+qAZ+Q4pMsES0ZQwpG1IAmSVGKA69vaA0fi0C64DFIJRCnHEJmE3dWhI+GQ LKVSCm55S4wmF14hroggKjmAsArZvvk0mJhjyV6HgBf5VhPwkz2E4JVSHV8Ef1NWWskKIdmb4Amo HvilI2Ky39eqS8ln09ufzhm5fq84PpqlMnolSSHFEPOCO2wmB6Wfd8j/+Vlw3Cm9vyiv1ZXHME7H cYnWXvJfga21v1BNjPN8/Q/etuhr6+11W1mr4NzelpfcYNugDmj8Abz9g/MvQZ6m++F7aeR2IAsO KTzjce4YVIlAnNbLBnEgweMXbvwMPLa3/h8Fnbl7RR0zH3EsLytO7UNhYjSlHNoWteEvJF02OCt1 hia6PXDkE8XXRUvhAzG2LIXtDwR0zVR+ZiQLAAAAAElFTkSuQmCC User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:9Ipjb/aPPAH7EDu2A6rZohlILQA= Original-Newsgroups: gnu.emacs.bug Original-Lines: 49 Original-NNTP-posting-host: adsl242216.vnet.hu Resent-Date: Sun, 15 Jun 2003 15:11:07 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5310 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5310 Hi, There was quite a bit of traffic about vertical scrolling hanging emacs when scroll-margin is set. I tried to do a little research on the topic and got the following. Last time I wrote: > Invoked "emacs -q --no-site-file", then I did > > M-x set-variable RET scroll-margin RET 2 RET > > Emacs locks up "only" when the last line of the buffer is visible in the > window, but it is (strictly) closer to the bottom than scroll-margin and > there are some blank lines, too. So, by setting s-m to 2, the problem > occurs only when there is exactly one blank line at the bottom. [...] I have to amend that: the problem occurs only in 21.* emacsen, and only if scoll-margin*2 > next-screen-context-lines. So a workaround for everyone is to set n-s-c-l to at least 2 * s-m. The behaviour of emacs in that case is still funny at the end of buffers, but at least it doesn't lock up. I also tried to debug it. The problem is (quite expectedly) in file window.c, function window_scroll_pixel_based, lines 4126-4127. ,----[ window.c, lines 4121-4129 ] | if (n > 0) | { | /* We moved the window start towards ZV, so PT may be now | in the scroll margin at the top. */ | move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); | while (it.current_y < this_scroll_margin) | move_it_by_lines (&it, 1, 1); | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); | } `---- The while loop turns out to be an infinite loop, because move_it_by_lines doesn't increase it.current_y. I believe the problem is that when emacs tries to preserve lines from the previous page, it is confused by the empty lines at the bottom of the window. Howver, I don't exactly know how or why. Would someone who's familiar with window.c go deeper into it? It is the first time I'm looking at emacs source, so I wouldn't mind if this person didn't have to be me. David