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: Wed, 16 Aug 2023 19:53:25 +0300 Message-ID: <83sf8j6i9m.fsf@gnu.org> References: <83mszb0w9l.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32939"; 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 Wed Aug 16 18:53:52 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 1qWJmJ-0008Et-2S for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Aug 2023 18:53:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWJlp-0002iB-4N; Wed, 16 Aug 2023 12:53:21 -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 1qWJln-0002i3-WE for help-gnu-emacs@gnu.org; Wed, 16 Aug 2023 12:53:20 -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 1qWJln-0002hf-OV for help-gnu-emacs@gnu.org; Wed, 16 Aug 2023 12:53:19 -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=QZADaQv36ZskpJKBxpewvnsvPUjxsuZYiVCzMWgY74k=; b=ivY/Qxdcm32A sqNTN0Hb3sP1Ht6w5u4bm7KalGPFtcQT/tOgyXfLouMxl7p7uBLDKTYKYD/yDNcbr/eIxmfAMrH+x 1oxapG0a+fE14f1eyjAE/lFOiP39m31Pf/4QuJG+IlfF8DdaVwCpXs6z3Inr/HAGdpgoAFZxNPmwI A4mrfqTO1bK+RRi95OvWyqPDgBGJc0dv5uY+CCjPtfxi4s3P5LqYKEFZOJpkOnPm4MWRBBlOh/Vtn deuW/ogPYlHldX+HoSOurPlBBhKsHQ1rJr6FlrXuSdo9VGIEKuSxGcNdo0g1RJX/uoR6T/TH8N7n/ GhV+b9y++UMT0nOSmq8Fxg==; In-Reply-To: (message from Spencer Baugh on Wed, 16 Aug 2023 12:20:23 -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:144835 Archived-At: > From: Spencer Baugh > Date: Wed, 16 Aug 2023 12:20:23 -0400 > > I thought about what behavior I want, exactly, and I think it's this: > when point is off-screen after scroll-up, we should first try to move > point to "window-end before we scrolled", and only if that position is > also off-screen should we move point to window-start. (Currently we > unconditionally move point to window-start) > > Like this: > > (defun my-scroll-up-command (&optional arg) > (interactive "^P") > (move-to-window-line -1) > (scroll-up-command arg)) > > (defun my-scroll-down-command (&optional arg) > (interactive "^P") > (move-to-window-line 0) > (scroll-down-command arg)) > > except of course this implementation moves point even if it's not > necessary. > > Does this seem like a reasonable feature to add to the scrolling code? I don't understand what you have in mind. The above commands seem to do what you want only when ARG is 1. Or what did I miss? For scrolling just one window-full, setting next-screen-context-lines to 1 should do what you want. For scrolling more than that, I don't understand how to generalize what you want.