From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: set-window-vscroll causes infinite loop in redisplay Date: 26 Feb 2003 01:20:51 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xptpfsxi4.fsf@kfs2.cua.dk> References: <5xheauqx9x.fsf@kfs2.cua.dk> <5xsmudr889.fsf@kfs2.cua.dk> <87u1et7mf2.fsf@computer.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1046215487 28341 80.91.224.249 (25 Feb 2003 23:24:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 25 Feb 2003 23:24:47 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18noRJ-0007Mx-00 for ; Wed, 26 Feb 2003 00:24:45 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18nohT-0007y4-00 for ; Wed, 26 Feb 2003 00:41:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18noPP-0005EJ-04 for emacs-devel@quimby.gnus.org; Tue, 25 Feb 2003 18:22:47 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18noOq-00054d-00 for emacs-devel@gnu.org; Tue, 25 Feb 2003 18:22:12 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18noOW-0004qo-00 for emacs-devel@gnu.org; Tue, 25 Feb 2003 18:21:55 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18noOU-0004lP-00 for emacs-devel@gnu.org; Tue, 25 Feb 2003 18:21:50 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id ED1A27C018; Wed, 26 Feb 2003 00:21:48 +0100 (CET) Original-To: "D. Goel" In-Reply-To: <87u1et7mf2.fsf@computer.localdomain> Original-Lines: 51 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11948 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11948 "D. Goel" writes: > hello > > I can get set-window-vscroll to work from M-: or from inside functions > containing that one single command. > > Example: > > (defun vel-scroll-up-fractional (acc) > (set-window-vscroll nil acc)) > > works just fine when acc is 0.5 > > However, > try > > (defun vel-scroll-up (amount acc) > (scroll-up amount) > (set-window-vscroll nil acc)) > > where amount is 0 and acc is 0.5. (the first one is a dummy line > supposed to do nothing here..) > > And the second line seems to have no effect at all. > I can confirm this (not) happening here too. The problem seems to that after a scroll (even a zero scroll), the function window_scroll_pixel_based sets w->force_start = Qt, which later causes the redisplay engine to set w->vscroll to 0. Since this happens during redisplay, the set-window-vscroll function has already been called, and the explicit setting of w->vscroll is lost. The following version is one way to work-around this problem: (defun vel-scroll-up (amount acc) (scroll-up amount) (sit-for 0) (set-window-vscroll nil acc)) I think the proper fix is to define a separate w->vscroll_extra member (controlled via set-window-vscroll) which specifies the smooth scroll offset the user wants ... and let the automatic vscroll adjustment take this into account (except at the top and bottom of the buffer). -- Kim F. Storm http://www.cua.dk