From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Allowing point to be outside the window? Date: Thu, 09 Dec 2021 13:45:03 +0200 Message-ID: <835yryuhmo.fsf@gnu.org> References: <87ilwd7zaq.fsf.ref@yahoo.com> <87ilwd7zaq.fsf@yahoo.com> <83bl24yaed.fsf@gnu.org> <87sfvg7l51.fsf@yahoo.com> <83zgpowu23.fsf@gnu.org> <87zgpo5tws.fsf@yahoo.com> <83pmqkwi6r.fsf@gnu.org> <87v90c5su6.fsf@yahoo.com> <83o864wg2a.fsf@gnu.org> <87ilwb68ck.fsf@yahoo.com> <83zgpnunfo.fsf@gnu.org> <87fsrf3xmd.fsf@yahoo.com> <83y257ulfp.fsf@gnu.org> <8735ne4e0e.fsf@yahoo.com> <87czmcvcs1.fsf@yahoo.com> <83sfv85y36.fsf@gnu.org> <87v904tsvv.fsf@yahoo.com> <83h7bo5m1x.fsf@gnu.org> <87ilw3ubfp.fsf@yahoo.com> <83h7bn4e55.fsf@gnu.org> <877dcipjmk.fsf@yahoo.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31282"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Dec 09 12:46:50 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvHsv-0007wj-Eg for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Dec 2021 12:46:49 +0100 Original-Received: from localhost ([::1]:41190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvHsu-0008Qp-5R for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Dec 2021 06:46:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53490) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvHrU-0007P6-7q for emacs-devel@gnu.org; Thu, 09 Dec 2021 06:45:20 -0500 Original-Received: from [2001:470:142:3::e] (port=39036 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvHrT-0007yF-NE; Thu, 09 Dec 2021 06:45:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=N6NPSB6JXTEydNkVB/2snww8TfS4prQpvGuOE6ZCwZg=; b=Lo2j0zxxAQxb DBqjlGUtvXd1kUQaBT8coPZ2QKkkPJCbRQO2M/0DD/TbrytALOdkjFiE2XS6GoQw4xJIRWNN5WiCG LQtfNZtgXzfG0MnHyUz+MH54dUdM3WRiWyOR/plULVxi20TYTk483rg/6YqCvQamyAnFuqsavov2w SIahvL2JRQC4gRh2CZsrPJaZO15Uju8S4fN6SSf/gBpMpsQY8f7CpAE+ZVCBnnEMdlLLaD10VJKis eYBm6u/whsKvyL/tVXoINLYvWwp/sM/Q+MLjGeeHGEp2gvFGrMGB0CIh9HA1MSNIEgrKzYh4ttJIa QoJlfHm8RyHLY9M+2/8uDw==; Original-Received: from [87.69.77.57] (port=1464 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvHrT-0003Qa-AE; Thu, 09 Dec 2021 06:45:19 -0500 In-Reply-To: <877dcipjmk.fsf@yahoo.com> (message from Po Lu on Mon, 06 Dec 2021 10:11:47 +0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:281482 Archived-At: > From: Po Lu > Cc: emacs-devel@gnu.org > Date: Mon, 06 Dec 2021 10:11:47 +0800 > > WDYT about the attached patch? It recenters the display whenever PT != > w->last_point, and it seems to work very well. > > It also introduces a new variable `scroll-move-point' that controls if > the scrolling commands will try to move point to stay visible. Once again, it's hard to understand the main ideas behind the feature. You explained above when it brings point into the view, but what I'm looking for is an explanation for how to modify redisplay_window when this feature is turned ON, without losing too much of the existing redisplay functionality. Also, a large part of the patch seems to change mainly whitespace, so please use the -w switch to show diffs ignoring the whitespace changes, because otherwise it's very hard to spot the real changes. A couple of comments below: > --- a/src/window.c > +++ b/src/window.c > @@ -5576,7 +5576,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) It seems you made changes for GUI scrolling, but not for TTY scrolling? Is this feature supposed to be disabled on TTY frames? > @@ -17768,6 +17770,9 @@ try_scrolling (Lisp_Object window, bool just_this_one_p, > else > scroll_max = 0; > > + if (!keep_point_visible) > + goto out; > + > too_near_end: I'm confused here. This bypasses all of try_scrolling's code, which can select a new window-start because, for example, point moved out of the visible portion of the window. Does this mean that when this feature is turned ON, scrolling of the window in these cases is no longer supported? For example, let's say I pressed C-n and that moved point below the window's end (with the default zero value of scroll-margin) -- does it mean the window will not scroll, leaving point invisible in this case? That brings me back to a question I already asked: how do users tell Emacs when they deliberately want to move point outside of the window and when they want Emacs to scroll the window to make point visible, as before? > @@ -18183,6 +18190,10 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, > return rc; > #endif > > + /* TODO: enable this optimization. */ > + if (!keep_point_visible) > + return CURSOR_MOVEMENT_CANNOT_BE_USED; Likewise here: you are disabling one of the more important redisplay optimizations, which minimizes redisplay work when the user just move point a little ways. Can you tell why this needs to be disabled under the new behavior? it seems to be unrelated, because the optimization only does its thing when point didn't leave the window. > + debug_method_add (w, "real redisplay starts"); This will have to go eventually, as this trace is not useful in general. > + /* TODO: enable this optimization. */ > + if (!keep_point_visible) > + return false; This optimization also doesn't necessarily have anything to do with point being outside of the window.