From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Psionic K Newsgroups: gmane.emacs.help Subject: Minimizing automatic scrolling Date: Sun, 12 Nov 2023 22:53:32 +0900 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30968"; 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 Sun Nov 12 14:54:49 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 1r2AvJ-0007rU-Jz for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 14:54:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2AuN-0005jS-3j; Sun, 12 Nov 2023 08:53:51 -0500 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 1r2AuK-0005j0-OD for help-gnu-emacs@gnu.org; Sun, 12 Nov 2023 08:53:48 -0500 Original-Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r2AuI-0004TB-Ei for help-gnu-emacs@gnu.org; Sun, 12 Nov 2023 08:53:48 -0500 Original-Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-d9beb865a40so3648928276.1 for ; Sun, 12 Nov 2023 05:53:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=positron.solutions; s=google; t=1699797224; x=1700402024; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=1NoK4KMTRkLASnVcuhR2mOfn0S5arJMWzZVJ9GWPhmY=; b=MIxY4r9YzGNZNLV5k+m39WAWg1L0Gkm4LQGclyadoilat4KYVKfoXF4D/h8UDmBgAj a7+U/zl3VN9iIcqYtCkWWzvrhlTlTbPzOa/CHH1uuxOPZ3b/oipvJldPuetXvs1G3ZC+ 9VRIL+/chSb3CLXiBLs1aRUwnzUwguR+rUsH7D6wdtGYyHvKOUjYxfoF56N4d3SWRrNe HmJpDjMASbc8arpsUP7Ya9dASWn/SIkFQmflcaxdLb6ltPCyke95wUvX9nuYhTKSJwg1 LGJ1DCcr5KoFyAgn6uJB50MyrTEExbpPsoDG9Uua6JQpjXenGusVIoCTQb4Qm5QPth9t tgrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699797224; x=1700402024; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1NoK4KMTRkLASnVcuhR2mOfn0S5arJMWzZVJ9GWPhmY=; b=E2DBoHtInWXMas5diQ04a4SnVpwalSDB1C4j9qlWcpg7h3twQKXlfizSbPdEohWNd8 iiyeetEfuP0Y12gpJMR73erR6mySTohW1Ntp1+hq8AWmA2Cd8GHkmKjQXuIRMf8me5Sh s3ykr4qYagXD3+BeiidPWTCYvbRwIDdYgnIc6IkhNlD8DL2y6YRc53Ib0meUEQD7bfeM 8pHsauurRMrAx4YJfDNTB5tAUDa0tfUpJ1RUW7Te3jWIB1jamFAZBDW6bJULAwiVIhaR /P4wBgflMkIYel8GyY2aL8sphKuwxqBovl0eX7HgE2nDYtcCgPVHwD31PRDp9+C4D/bh ubBQ== X-Gm-Message-State: AOJu0YxprIFdi0saJpGAc0itBHN3tivkd5LGb2AulEko8Fgz9yrZA5yA trxcaEa+R0qaalq6DBwcbMHjIwMbyNlct3K9NK+CvF6FGKp7yi0E+sk= X-Google-Smtp-Source: AGHT+IENlFHFu2cFc20yUR6+8pmUknVOoSvMpBL0ZOSSSMc84Ckr6AVpVknQWkAGPdDE8lTZAMdJA7mBiWHyuR67Qkg= X-Received: by 2002:a25:42d2:0:b0:da0:c8d1:5c5 with SMTP id p201-20020a2542d2000000b00da0c8d105c5mr3649578yba.41.1699797223947; Sun, 12 Nov 2023 05:53:43 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::b34; envelope-from=exec@positron.solutions; helo=mail-yb1-xb34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:145488 Archived-At: I cannot find an option to disable all automatic scrolling caused by minibuffer setup or transient setup. I devised a solution that illustrates the issue I'm managing: ;; Auto-scroll as little as possible. Avoid moving the point. ;; Firstly, dynamically set `scroll-conservatively' to avoid automatic re-centers. ;; We want automatic re-center when swiper for example goes off screen, but for ;; minibuffer or transient display, we want the minimum possible scroll= . ;; And finally, dynamically shrink the margin so that the space created by ;; margin will all be used up before automatic scrolling can occur and margins ;; will not be maintained during minibuffer or transient display. (defvar pmx--no-herky-jerk-margin nil) (defvar pmx--no-herky-jerk-scroll-conservatively nil) (setq scroll-margin 12) ; larger than ivy size, eliminating most scroll= s (defun pmx--no-herky-jerk-enter (&rest _) "Shrinks margin." (setq pmx--no-herky-jerk-scroll-conservatively scroll-conservatively) (setq scroll-conservatively 101) (setq pmx--no-herky-jerk-margin scroll-margin) (setq scroll-margin 0)) (defun pmx--no-herky-jerk-exit () "Expands margin." (when pmx--no-herky-jerk-scroll-conservatively (setq scroll-conservatively pmx--no-herky-jerk-scroll-conservatively)) (setq pmx--no-herky-jerk-scroll-conservatively nil) (when pmx--no-herky-jerk-margin (setq scroll-margin pmx--no-herky-jerk-margin)) (setq pmx--no-herky-jerk-margin nil)) (add-hook 'minibuffer-setup-hook #'pmx--no-herky-jerk-enter) (add-hook 'minibuffer-exit-hook #'pmx--no-herky-jerk-exit) ;; Add the same for transient (with-eval-after-load 'transient (advice-add 'transient-setup :before #'pmx--no-herky-jerk-enter) (add-hook 'transient-exit-hook #'pmx--no-herky-jerk-exit) (setopt transient-hide-during-minibuffer-read t)) Happy to work on a patch if one is needed. I also noticed that transient's default side-window display has a very desirable property of only triggering scrolling once and then leaving the window in a state where it won't scroll during the next transient display. The minibuffer cleans up its scrolling, causing repeated "herky-jerk" events. I believe we need two options. The first should be to not automatically scroll unselected windows during resize. The second should be to retain scrolls caused by minibuffer expansion. >From what I have gathered, the window data model doesn't have a way to express the idea that a window is temporary, so packages can't advertise to Emacs that they are intended for temporary focused usage. On focus, a window should scroll if appropriate, helping to visually indicate that a window has become selected and fix the mis-indication that a buffer has become selected and received unintended commands when a resize has occurred. Having an option to simply not auto scroll during resize when not selected and another option to preserve scrolls caused by minibuffer expansion would allow near perfect behavior. --=20 =EB=82=A8=EB=B0=B1=ED=98=B8 =EB=8C=80=ED=91=9C =EA=B2=B8 =EA=B3=B5=EB=8F=99 =EC=B0=BD=EC=97=85=EC=9E=90 =ED=8F=AC=EC=A7=80=ED=8A=B8=EB=A1=A0