From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#35860: Delayed window positioning after buffer display Date: Wed, 19 Jun 2019 00:02:42 +0300 Organization: LINKOV.NET Message-ID: <87fto61ua5.fsf@mail.linkov.net> References: <87o93ucjsi.fsf@mail.linkov.net> <83ef4p7prf.fsf@gnu.org> <87a7fc51qm.fsf@mail.linkov.net> <83k1eg5pmx.fsf@gnu.org> <87k1efhkgp.fsf@mail.linkov.net> <2347769f-9ab3-c1b6-699e-4e89a7d8eb1c@gmx.at> <875zpb4zdw.fsf@mail.linkov.net> <878su5i67f.fsf@mail.linkov.net> <87muik3svu.fsf@mail.linkov.net> <4d0733b1-4ee0-222b-395a-8f26ff76f2da@gmx.at> <87imt6jva7.fsf@mail.linkov.net> <87h88p8e5z.fsf@mail.linkov.net> <871rzsdj5a.fsf@mail.linkov.net> <4465efef-794f-de5d-ed5d-04403680a622@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="116141"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 35860@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 18 23:35:28 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hdLlG-000U0c-Ov for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Jun 2019 23:35:26 +0200 Original-Received: from localhost ([::1]:33638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdLlF-00037S-QJ for geb-bug-gnu-emacs@m.gmane.org; Tue, 18 Jun 2019 17:35:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39870) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdLk3-0002M1-NZ for bug-gnu-emacs@gnu.org; Tue, 18 Jun 2019 17:34:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdLjz-0005qA-JV for bug-gnu-emacs@gnu.org; Tue, 18 Jun 2019 17:34:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdLju-0005iU-9M for bug-gnu-emacs@gnu.org; Tue, 18 Jun 2019 17:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hdLju-00019G-6O for bug-gnu-emacs@gnu.org; Tue, 18 Jun 2019 17:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Jun 2019 21:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35860 X-GNU-PR-Package: emacs Original-Received: via spool by 35860-submit@debbugs.gnu.org id=B35860.15608935984343 (code B ref 35860); Tue, 18 Jun 2019 21:34:02 +0000 Original-Received: (at 35860) by debbugs.gnu.org; 18 Jun 2019 21:33:18 +0000 Original-Received: from localhost ([127.0.0.1]:45693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hdLjB-00017z-SZ for submit@debbugs.gnu.org; Tue, 18 Jun 2019 17:33:18 -0400 Original-Received: from bee.elm.relay.mailchannels.net ([23.83.212.14]:62423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hdLj8-00017n-Pm for 35860@debbugs.gnu.org; Tue, 18 Jun 2019 17:33:15 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 08FA82C1DCC; Tue, 18 Jun 2019 21:33:12 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (100-96-85-75.trex.outbound.svc.cluster.local [100.96.85.75]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 40E332C1C1B; Tue, 18 Jun 2019 21:33:11 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Tue, 18 Jun 2019 21:33:11 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Rock-Soft: 62257149711c4407_1560893591849_3273968895 X-MC-Loop-Signature: 1560893591848:3948085084 X-MC-Ingress-Time: 1560893591848 Original-Received: from pdx1-sub0-mail-a65.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a65.g.dreamhost.com (Postfix) with ESMTP id 3712182989; Tue, 18 Jun 2019 14:33:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=7WnKQSi/QrWjHUr1kTAeEJEaMsY=; b= wUM8Gg0olyX7YyzFameBbKmz//i/g3GDb9Ka4HubAcJd/X2VWwPJV4c3t6Zn26Nl TbIXAmAfx0l7gTwIhxzgjnCkTKIGzJJCPNRtdqdJ7BgOLO+tqB24PbwsFzXwgT4u 4w+jDaFPpOVTEiDrXh6fg/lsSCLawxTNinQMfFHm8Ds= Original-Received: from mail.jurta.org (m91-129-109-209.cust.tele2.ee [91.129.109.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a65.g.dreamhost.com (Postfix) with ESMTPSA id 0C84282984; Tue, 18 Jun 2019 14:33:07 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a65 In-Reply-To: <4465efef-794f-de5d-ed5d-04403680a622@gmx.at> (martin rudalics's message of "Tue, 18 Jun 2019 10:19:21 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrtddtgddufeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrddvtdelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledrvddtledprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehruhgurghlihgtshesghhmgidrrghtnecuvehluhhsthgvrhfuihiivgeptd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160803 Archived-At: >> +(defvar delayed-window-point nil > > Name space conventions would recommend 'window-delayed-point'. Then 'window-delayed-start' would be too ambiguous. Maybe then 'window-start-delayed' and 'window-point-delayed'. >> + "Marker to override default `window-point' in all windows. > > Why "marker" and why "all windows"? As for the former, I think it > makes sense because then one can specify an insertion type as well. > But IIRC you earlier wanted to allow plain integers here too? Yes, plain integers should be allowed as well. >> +`delayed-window-point' is a buffer-local marker you can move to a valid >> +position of the buffer shown in the window in order to override the standard >> +positioning mechanism (`point-min') chosen by window displaying functions.") > > IIUC there is no such "mechanism" except for buffers just created. > And what about 'switch-to-buffer-preserve-window-point'? "window ??? > displaying functions" implicitly hints at the fact that the mechanism > works only when the buffer is shown by 'display-buffer'. But are we > sure that this restriction always applies? Maybe the same should be allowed for 'switch-to-buffer' as well, and even for buffers displayed by set-window-configuration. >> I see no reason to use macros here. >> We need to replace these macros with the elegant solution that we already >> have of using action alists. > > Macros are useful in as much as they allow to specify the evaluation > order of their arguments. Action alists are dumb in this regard. The problem is that currently the whole cycle of buffer displaying doesn't allow executing arbitrary code at different stages: there are no pre-display-buffer and post-display-buffer hooks. Adding such hooks would allow to get rid of macros easily. For example, instead of using two variables 'window-point-delayed' and 'window-start-delayed', a pre-display hook in 'view-lossage' will be able just to set a buffer-local run-once post-display hook that will adjust the window positions after the buffer is displayed in the window. Another candidate that can be placed into such post-display hook is fit-window-to-buffer for cases when adding an action alist as an arg of display-buffer call is not possible. And vice versa, pre/post-display actions could be specified in an action alist of display-buffer, when using hooks is not possible.