From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#70386: 30.0.50; (recenter 0 t) does not put point on top of the window Date: Sun, 12 May 2024 06:58:32 +0000 Message-ID: <87a5kvtt2f.fsf@localhost> References: <87v84jrjir.fsf@localhost> <864jc3n510.fsf@gnu.org> <87plurrb2z.fsf@localhost> <86wmoyk3m4.fsf@gnu.org> <86plubw6my.fsf@gnu.org> <87edarf50m.fsf@yahoo.com> <87a5lff2h1.fsf@yahoo.com> <87jzkgaumg.fsf@localhost> <86pltv77w2.fsf@gnu.org> <87a5kz2ze7.fsf@yahoo.com> <87seyotf2v.fsf@localhost> <86msow1bdb.fsf@gnu.org> <87pltsteiu.fsf@localhost> <86le4g19ya.fsf@gnu.org> <87jzk0tcl9.fsf@localhost> <86fruo18pg.fsf@gnu.org> <87h6f4tbbl.fsf@localhost> <86eda71sdx.fsf@gnu.org> <87eda7tuya.fsf@localhost> <86a5kv1qlc.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="6896"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 70386@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 12 08:58:33 2024 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 1s63AG-0001dm-MS for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 May 2024 08:58:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s63A0-0000dE-RB; Sun, 12 May 2024 02:58:17 -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 1s639n-0000bI-4e for bug-gnu-emacs@gnu.org; Sun, 12 May 2024 02:58:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s639m-0001P9-Pa for bug-gnu-emacs@gnu.org; Sun, 12 May 2024 02:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s639m-00044O-59 for bug-gnu-emacs@gnu.org; Sun, 12 May 2024 02:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 May 2024 06:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70386 X-GNU-PR-Package: emacs Original-Received: via spool by 70386-submit@debbugs.gnu.org id=B70386.171549703015636 (code B ref 70386); Sun, 12 May 2024 06:58:02 +0000 Original-Received: (at 70386) by debbugs.gnu.org; 12 May 2024 06:57:10 +0000 Original-Received: from localhost ([127.0.0.1]:52786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s638w-000448-CX for submit@debbugs.gnu.org; Sun, 12 May 2024 02:57:10 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:41633) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s638t-00043p-IE for 70386@debbugs.gnu.org; Sun, 12 May 2024 02:57:08 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 781AB240028 for <70386@debbugs.gnu.org>; Sun, 12 May 2024 08:57:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1715497021; bh=FOvASJHiJ3iZjXAiIHr56oJPSH+HnouDh+bSa4/AF7s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=C69s+NQgnzR6/NpcoXkNLHVauUTuRNkNX/ZdRyjUy2VytzsXTqxUGuUeMcK9aoTCk u9IqOPa3sjnTDtvNJ9pUyiKnm4kfuljh3osY8EOFV2tM5UmbqupnymyqzT5Bpyn0hG zmyZbjnRJp/BkDOj8BmGoPqC1AKHARSi9EbrLwlwJnjWfmdKWJj3VSpNA60VXLyhHt TKflFX/GOk6zuWCQ39MWkoWG6RrYdQvNieW3Swo80Uw18G3p+SwKeApMUqhCScPy0G 9TRzOv22d3BJ/jbhemKkpfg2LUSoL8TtWl/8ABhzGQyJNGmHL3y5kTZfS20YkQ3glN jDPy7LMvoE0YA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VcYMJ57L3z6tyR; Sun, 12 May 2024 08:57:00 +0200 (CEST) In-Reply-To: <86a5kv1qlc.fsf@gnu.org> 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:284894 Archived-At: Eli Zaretskii writes: >> Why does it need to matter? Right before calling recenter, the point is >> at 757, as you can see from point-list in my test. > > That's not what I see in my testing. Point usually is there, but not > always. The whole recipe is not deterministic, as I told many > messages ago. I do not consider the case when scrolling "overshoots" the window boundary and moves point as a bug. I only consider the other case, when the point does not move as a bug. Try the following - it should not overshoot and should be more deterministic: (setq point-list nil) (setq current-line-list nil) (progn (push (point) point-list) (push (count-lines 1 (point)) current-line-list) (require 'pixel-scroll) (push (point) point-list) (push (count-lines 1 (point)) current-line-list) (pixel-scroll-precision-interpolate (* -1 (line-pixel-height) (max 0 (- (count-screen-lines (window-start) (point)) 4))) nil 1) (push (point) point-list) (push (count-lines 1 (point)) current-line-list) ;; Call original recenter for final adjustment. (recenter 0 t) (push (point) point-list) (push (count-lines 1 (point)) current-line-list)) >> May you please explain how I am supposed to know this from reading the >> docstring? > > Would knowing that convince you that your snippet is based on shaky > grounds? That would at least make me aware that there are shaky grounds to worry about. >> And even then, when scrolling current line to be on the top (which is >> what (recenter 0 t) supposed to do), as a user, I will be surprised that >> the current line remains at line 21! - what kind of "best effort" is >> that when the result if off by 21 lines? surely, Emacs can do better. > > You again assume that you know what is the "current line" when > 'recenter' is called. Given that the code immediately before that > scrolls the window, what is the "current line" is not well defined. By current line, I mean "line containing point". Again, I am not worried about the case when scrolling changes point position and that new position gets recentered. I am only worried about the case when the rencentering does not alter the final window scroll, despite the point not being on the requested visual line. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at