From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Greselin Newsgroups: gmane.emacs.bugs Subject: bug#57179: 29.0.50: 'wrong-number-of-arguments' for function of two arguments called from 'window-scroll-functions' Date: Sat, 13 Aug 2022 18:17:54 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d6e7d605e621bf03" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32141"; mail-complaints-to="usenet@ciao.gmane.io" To: 57179@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Aug 13 18:19:19 2022 Return-path: Envelope-to: geb-bug-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 1oMtr4-0008AD-K8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 18:19:18 +0200 Original-Received: from localhost ([::1]:52686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMtr3-0007tu-LB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Aug 2022 12:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMtqo-0007s1-FK for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 12:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMtqo-0003vx-7M for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 12:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMtqn-0005NS-TH for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 12:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Greselin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Aug 2022 16:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57179 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166040752220639 (code B ref -1); Sat, 13 Aug 2022 16:19:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Aug 2022 16:18:42 +0000 Original-Received: from localhost ([127.0.0.1]:34943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMtqT-0005Mo-EQ for submit@debbugs.gnu.org; Sat, 13 Aug 2022 12:18:42 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMtqP-0005Md-3g for submit@debbugs.gnu.org; Sat, 13 Aug 2022 12:18:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMtqN-0007Vw-By for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 12:18:36 -0400 Original-Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:46840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMtqJ-0003v7-Pz for bug-gnu-emacs@gnu.org; Sat, 13 Aug 2022 12:18:34 -0400 Original-Received: by mail-qv1-xf34.google.com with SMTP id l18so2650128qvt.13 for ; Sat, 13 Aug 2022 09:18:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc; bh=4/yXNxIxzSpboa3UKWEBXtiZL9bEuhOJdHLA99STO98=; b=fj5HgOX+hGnFlSPI3uiT15QTfe0cyEJdMfFd6+h1gjoaLJLGbaRm4Z/u3jnvHjj/iP HCWa+oNjvAJ/x90Ttt6Q4DcI7ZaPDH+UOXDuqTa5w2r1Aoj5YR4u4ylYUbnIsfneLMyZ Y3nJ0fwyUs8MH9CBKjaxhbC7yp1vi5NXzQMAvTFC7/txH/qn4jMw33alvm/dNqzAetjv oDxMFv1jFicEjeLHjBemlK4q8vyWiOmVK2apoXnUif71XQRxvGAt8CUyOfcnafWpmhmu UAFleuMTo7VmBMfV2M/N+MO/7uoauEbk4JbtLk5UVSxiuSjdkGabGzc5161fMhxP7pMG g8rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc; bh=4/yXNxIxzSpboa3UKWEBXtiZL9bEuhOJdHLA99STO98=; b=F7oGa6etpcAor3rF9e52PoGaX2LzvUlnABq/iGPEuCFZP5ofaLSiKa1HmaTZb5DDav gBoNqLzP9FLkpFQ03Cba+mXvxOj+AbA8NqhRDuQSxqJ/tyh1hc0H/waZXpSa1iWz/4Qw jhptPPtUHuN0GkpiyFL0JZgipEM5h4FHYN8KLFhbcwpokFYO8zrLOt1K+kDEF/PxdNjS YERYydJnobLEw5JcbtHXBmHUZFMLo+tkLivQtFtYcBcublWFjiZUg3VHpaREos+9cVND FGKLKMbvlcloedxkfw35mweccvPwXQcqmKkTycY28aPQNABWUVbQLOkOzuVttm9OFvhj 3rJA== X-Gm-Message-State: ACgBeo0d3aj0gytGQiT2Fhe7a3qSqZYoXZ7GKPZrlSo1plWUqZKkr81O hxkmIEJ6MJ8Dt3Jwrc/jWXnkWxHhBCb51v680ndOS2sulB8= X-Google-Smtp-Source: AA6agR6TzlFfk1zBawTk31sq7KK09Iq6g85YnpCzpcF8CtVA+KS39x2+eUrqlYcFOegs41C14bnbLZt0NShFReYxUlM= X-Received: by 2002:ad4:5be2:0:b0:476:7e0d:815f with SMTP id k2-20020ad45be2000000b004767e0d815fmr7438054qvc.57.1660407510393; Sat, 13 Aug 2022 09:18:30 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=greselin.andrea@gmail.com; helo=mail-qv1-xf34.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, FREEMAIL_FROM=0.001, 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239562 Archived-At: --000000000000d6e7d605e621bf03 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi all, I have this function (the part at issue here should be the first line): (defun my-recenter-after-jump (window _window-start-after) "Recenter the point after a non-scroll command brings it out of view. This function is meant to be called from the hook =E2=80=98window-scroll-functions=E2=80=99." (with-selected-window window (unless (or (> 0.001 (float-time (time-subtract (current-time) buffer-display-time))) ; Don=E2=80=99t run this function after a change of = buffer. Non-nil here means the selected window displayed the current buffer less than a thousandth of a second ago, so it was most likely a change of buffer that triggered =E2=80=98window-scroll-functions=E2=80=99, not a scroll. See= also https://emacs.stackexchange.com/questions/63558/how-to-distinguish-a-scroll= -from-a-change-of-buffer-in-a-function-called-from-w ;; Don=E2=80=99t recenter for these ;; - major modes (memq major-mode '(help-mode ; =E2=80=98my-recenter-after-jump=E2=80=99 breaks scrolling with S= PC/ in Help mode and Info mode because they don=E2=80=99t obey =E2=80=98scroll-preserve-screen-position=E2=80=99 and =E2=80=98scroll-error= -top-bottom=E2=80=99. Info-mode)) ;; - minor modes isearch-mode ; For Isearch, change the value of =E2=80=98scroll-conservatively= =E2=80=99 and =E2=80=98hscroll-step=E2=80=99 in =E2=80=98isearch-update-post-hook=E2=80= =99 and =E2=80=98isearch-mode-end-hook=E2=80=99. Doing so allows recentering the point even after a purely horizontal scroll= . (bound-and-true-p view-mode) ; =E2=80=98my-recenter-after-jump=E2=80=99 breaks scrolling with S= PC/ in View mode because View mode doesn=E2=80=99t obey =E2=80=98scroll-preserve-screen-position=E2=80=99 and =E2=80=98scroll-error= -top-bottom=E2=80=99. (bound-and-true-p follow-mode) ;; - commands (and (symbolp last-command) (get last-command 'scroll-command)) ; Don=E2=80=99t check the value of the =E2=80=98scroll-co= mmand=E2=80=99 property for anonymous commands (it can=E2=80=99t be t anyway). (memq last-command '(recenter-top-bottom query-replace query-replace-regexp ; Query replacement is taken care of by the =E2=80=98recentering-on= -jump=E2=80=99 advice to =E2=80=98perform-replace=E2=80=99, which allows recentering the p= oint after a purely horizontal scroll. previous-line next-line ; Don=E2=80=99t let these commands trigger =E2=80=98my-recenter-af= ter-jump=E2=80=99. It happens when Emacs has a moment of lag during which the point slips beyond the scroll margin. previous-logical-line next-logical-line))) (let* ((bottom-line-before (line-number-at-pos (window-end))) (bottom-line-after (line-number-at-pos (window-end nil 'update))) ; NB: =E2=80=98window-start=E2=80=99 doesn=E2=80=99t take the = =E2=80=98update=E2=80=99 argument. (vertical-displacement (- bottom-line-after bottom-line-before))) (unless (> 2 (abs vertical-displacement)) ; The purpose of having the first =E2=80=98unless=E2=80=99 separate from this one is to call =E2=80=98line-number-at-pos=E2=80=99 only when it=E2=80=99s needed, because= it can be slow. See (2 links) https://emacs.stackexchange.com/questions/51648/how-to-detect-the-number-of= -lines-scrolled-from-scroll-up-down/51664#51664, https://emacs.stackexchange.com/questions/3821/a-faster-method-to-obtain-li= ne-number-at-pos-in-large-buffers (recenter) (when truncate-lines (my-horizontal-recenter))))))) ; REVIEW: Isn=E2=80=99t ther= e a built-in function for recentering the point horizontally? which I call from `window-scroll-functions` like this (add-hook 'window-scroll-functions #'my-recenter-after-jump) It's worked until I upgraded from v. 28.1 (from Fedora=E2=80=99s repos) to 29.0.50 (commit 6de88b6b02). Now I get Error in window-scroll-functions (my-recenter-after-jump): (wrong-number-of-arguments (lambda (window _window-start-after) "Recenter the point after a non-scroll command brings it out of view. This function is meant to be called from the hook =E2=80=98window-scroll-functions=E2=80=99." (let ((save-selected-window= --state (internal--before-with-selected-window window))) (save-current-buffer (unwind-protect (progn (select-window (car save-selected-window--state) 'norecord) (if (or (> 0.001 (float-time (time-subtract (current-time) buffer-display-time))) (memq major-mode '(help-mode Info-mode)) isearch-mode (and (boundp 'view-mode) view-mode) (and (boundp 'follow-mode) follow-mode) (and (symbolp last-command) (get last-command 'scroll-command)) (memq last-command '(recenter-top-bottom query-replace query-replace-regexp previous-line next-line previous-logical-line next-logical-line))) nil (let* ((bottom-line-before (line-number-at-pos (window-end))) (bottom-line-after (line-number-at-pos (window-end nil 'update))) (vertical-displacement (- bottom-line-after bottom-line-before))) (if (> 2 (abs vertical-displacement)) nil (recenter) (if truncate-lines (progn (my-horizontal-recenter))))))) (internal--after-with-selected-window save-selected-window--state))))) 0) All the best, Andrea --000000000000d6e7d605e621bf03 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all,
I have this function (the part at issue here sh= ould be the first
line):

=C2=A0 =C2=A0 (defun my-recenter-after-j= ump (window _window-start-after)
=C2=A0 =C2=A0 =C2=A0 "Recenter the= point after a non-scroll command brings it out of view.
=C2=A0 =C2=A0 T= his function is meant to be called from the hook
=C2=A0 =C2=A0 =E2=80=98= window-scroll-functions=E2=80=99."
=C2=A0 =C2=A0 =C2=A0 (with-selec= ted-window window
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (unless (or (> 0.001 (f= loat-time (time-subtract (current-time) buffer-display-time))) ; Don=E2=80= =99t run this function after a change of buffer. Non-nil here means the sel= ected window displayed the current buffer less than a thousandth of a secon= d ago, so it was most likely a change of buffer that triggered =E2=80=98win= dow-scroll-functions=E2=80=99, not a scroll. See also https://emacs.stackexchange.com= /questions/63558/how-to-distinguish-a-scroll-from-a-change-of-buffer-in-a-f= unction-called-from-w
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 ;; Don=E2=80=99t recenter for these
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; =C2=A0 - maj= or modes
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (memq major-mode '(help-mode ; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=E2=80=98my-recenter-after-jump=E2=80=99 breaks scrolli= ng with SPC/<backspace> in Help mode and Info mode because they don= =E2=80=99t obey =E2=80=98scroll-preserve-screen-position=E2=80=99 and =E2= =80=98scroll-error-top-bottom=E2=80=99.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Info-mode))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; =C2=A0 - minor modes
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 isear= ch-mode ; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0For Isearch, change the value = of =E2=80=98scroll-conservatively=E2=80=99 and =E2=80=98hscroll-step=E2=80= =99 in =E2=80=98isearch-update-post-hook=E2=80=99 and =E2=80=98isearch-mode= -end-hook=E2=80=99. Doing so allows recentering the point even after a pure= ly horizontal scroll.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (bound-and-true-p view-mode) ; =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=E2=80=98my-recenter-after-jump=E2=80=99 bre= aks scrolling with SPC/<backspace> in View mode because View mode doe= sn=E2=80=99t obey =E2=80=98scroll-preserve-screen-position=E2=80=99 and =E2= =80=98scroll-error-top-bottom=E2=80=99.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (bound-and-true-p follow-mode)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; = =C2=A0 - commands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (and (symbolp last-command) (get last-command 'scroll= -command)) ; Don=E2=80=99t check the value of the =E2=80=98scroll-command= =E2=80=99 property for anonymous commands (it can=E2=80=99t be t anyway).=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (me= mq last-command '(recenter-top-bottom
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0query-replace query-replace-re= gexp ; =C2=A0 =C2=A0 =C2=A0 =C2=A0 Query replacement is taken care of by th= e =E2=80=98recentering-on-jump=E2=80=99 advice to =E2=80=98perform-replace= =E2=80=99, which allows recentering the point after a purely horizontal scr= oll.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0previous-line next-line ; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0Don=E2=80=99t let these commands trigger =E2=80= =98my-recenter-after-jump=E2=80=99. It happens when Emacs has a moment of l= ag during which the point slips beyond the scroll margin.
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0previous-logical= -line next-logical-line)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let* ((bo= ttom-line-before (line-number-at-pos (window-end)))
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(bottom-line-after (line-number-a= t-pos (window-end nil 'update))) ; NB: =E2=80=98window-start=E2=80=99 d= oesn=E2=80=99t take the =E2=80=98update=E2=80=99 argument.
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(vertical-displacement (- = bottom-line-after bottom-line-before)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (unless (> 2 (abs vertical-displacement)) ; The purpose of ha= ving the first =E2=80=98unless=E2=80=99 separate from this one is to call = =E2=80=98line-number-at-pos=E2=80=99 only when it=E2=80=99s needed, because= it can be slow. See (2 links) https://emacs.stackexchange.com/questions/51648/how-to-dete= ct-the-number-of-lines-scrolled-from-scroll-up-down/51664#51664, https://emacs.stackexchange.com/que= stions/3821/a-faster-method-to-obtain-line-number-at-pos-in-large-buffers
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (recenter)
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when truncate-lines
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (my-horizontal-recenter)))= )))) ; REVIEW: Isn=E2=80=99t there a built-in function for recentering the = point horizontally?

which I call from `window-scroll-functions` like= this

=C2=A0 =C2=A0 (add-hook 'window-scroll-functions #'my-= recenter-after-jump)


It's worked until I upgraded from v. 28= .1 (from Fedora=E2=80=99s repos) to
29.0.50 (commit 6de88b6b02). Now I g= et

=C2=A0 =C2=A0 Error in window-scroll-functions (my-recenter-after= -jump): (wrong-number-of-arguments (lambda (window _window-start-after) &qu= ot;Recenter the point after a non-scroll command brings it out of view.
= =C2=A0 =C2=A0 This function is meant to be called from the hook
=C2=A0 = =C2=A0 =E2=80=98window-scroll-functions=E2=80=99." (let ((save-selecte= d-window--state (internal--before-with-selected-window window))) (save-curr= ent-buffer (unwind-protect (progn (select-window (car save-selected-window-= -state) 'norecord) (if (or (> 0.001 (float-time (time-subtract (curr= ent-time) buffer-display-time))) (memq major-mode '(help-mode Info-mode= )) isearch-mode (and (boundp 'view-mode) view-mode) (and (boundp 'f= ollow-mode) follow-mode) (and (symbolp last-command) (get last-command '= ;scroll-command)) (memq last-command '(recenter-top-bottom query-replac= e query-replace-regexp previous-line next-line previous-logical-line next-l= ogical-line))) nil (let* ((bottom-line-before (line-number-at-pos (window-e= nd))) (bottom-line-after (line-number-at-pos (window-end nil 'update)))= (vertical-displacement (- bottom-line-after bottom-line-before))) (if (>= ; 2 (abs vertical-displacement)) nil (recenter) (if truncate-lines (progn (= my-horizontal-recenter))))))) (internal--after-with-selected-window save-se= lected-window--state))))) 0)

All the best,
Andrea
--000000000000d6e7d605e621bf03--