From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh 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:19:55 -0400 Message-ID: References: <83mszb0w9l.fsf@gnu.org> <83sf8j6i9m.fsf@gnu.org> <83msyq7s82.fsf@gnu.org> <83leea6ycm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36925"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:4ut8oXdeHAlVsFw3SbkokyJl890= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 14:21:03 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 1qWbzq-0009QM-Rj for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 14:21:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWbz1-00038v-L1; Thu, 17 Aug 2023 08:20: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 1qWbyy-00038j-KR for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 08:20:08 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWbyw-0002L5-C2 for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 08:20:08 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1qWbys-00083d-D1 for help-gnu-emacs@gnu.org; Thu, 17 Aug 2023 14:20:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:144856 Archived-At: Eli Zaretskii writes: >> 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) The code I'd want to modify is... > or moves it into the viewport. exactly this code. e.g. in window_scroll_line_based there's calls to Fvertical_motion, I'd want to add more logic just before those calls. I'd need to do the same for window_scroll_pixel_based. > 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. Hm, not sure why I'd need logic in Lisp, if I take the approach I just mentioned. (We'd need a defcustom of course to control the behavior, but other than 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.