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.help Subject: Re: Make scroll-{up, down} move point to {start, end} of newly visible text Date: Thu, 17 Aug 2023 08:18:17 +0300 Message-ID: <83leea6ycm.fsf@gnu.org> References: <83mszb0w9l.fsf@gnu.org> <83sf8j6i9m.fsf@gnu.org> <83msyq7s82.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20791"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 07:18:55 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1qWVPK-0005DT-Rc for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 07:18:55 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWVOd-0004NX-Tc; Thu, 17 Aug 2023 01:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWVOc-0004NP-NS for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 01:18:10 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWVOc-0006C9-Er for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 01:18:10 -0400 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=oShLebrLf4otFhXQS2kMxrUjMX29S5eHT4HR+N+2YQ4=; b=MwuEuqNsyhQ0 McrhGAtYKQMvt2ytGs6pycTA+sHzXWacZBuGNPwrd+kErQBiFO5JWuIku/APJ0CMaR16kEXGNuuP4 LQ1u1E3uiZ7qx1lTGtqrK07apmKn1Wz9oO2bsedo/IqTKv4xvp6ks4jQg5SuJekNAgJwI0+sEsDgb YG72fDdvazfaanref/OrwJnm4rJSKSgdOYB1GV27msU+dnPJG29ciBj1Vrxy+isb4sOqnVwNCArz4 dU55a8nmTVph+FsilvIgLhUsWVP7YuRsB+sO0EA9Kg5Uioqijm1g1xgtychSZe21YuB4zLB1aXd9l bY7kfxNjTZEjcaj2Dt996w==; In-Reply-To: (message from Spencer Baugh on Wed, 16 Aug 2023 16:32:22 -0400) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:144854 Archived-At: > From: Spencer Baugh > Date: Wed, 16 Aug 2023 16:32:22 -0400 > > Eli Zaretskii writes: > > > Either setting next-screen-context-lines to 1 should do what you want, > > or I still don't understand what you want when scrolling by more than > > one window-full. > > Well, yes, if next-screen-context-lines is 1 then > window-end-before-scroll and window-start-after-scroll are the same. So > that trivially provides the behavior I described, I suppose... > > But I want the behavior I described even when next-screen-context-lines > is greater than 1. (I personally set it to 10.) In that case, > window-end-before-scroll and window-start-after-scroll aren't the same, > and Emacs doesn't behave how I described. But in that case I don't have a clear idea how to incorporate what you want in the way scrolling is implemented in Emacs. The scrolling functions usually don't move point, they just set the window-start position according to the scroll-command argument and relevant user options. The actual scrolling is done by the display engine during the next redisplay cycle, and that either leaves point where it was (if point is still visible) or moves it into the viewport. This scrolling is general display feature, it can happen even if something other than a scrolling command caused it. Thus, knowing when to move point to a particular place is not trivial, and would need some variable exposed to Lisp or something like that, and then some non-trivial logic to use that. It is also not clear whether you want this only for scroll commands or also for other causes of scrolling the window. Maybe you could do something similar to how scroll-preserve-screen-position works. Feel free to work on this, of course.