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.devel Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames Date: Sat, 28 Jan 2023 18:02:48 +0200 Message-ID: <83a622abpz.fsf@gnu.org> References: <834jsccepb.fsf@gnu.org> <83sffuap62.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40621"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tgbugs@gmail.com, emacs-devel@gnu.org, larsi@gnus.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jan 28 17:03:42 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pLng6-000AJR-07 for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Jan 2023 17:03:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLnfS-0007ja-Sh; Sat, 28 Jan 2023 11:03:02 -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 1pLnfR-0007jR-QE for emacs-devel@gnu.org; Sat, 28 Jan 2023 11:03:01 -0500 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 1pLnfR-0002mY-Ce; Sat, 28 Jan 2023 11:03:01 -0500 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=H7zckoCNTatXsP5P3NcGrRcezB3tvNaNPx0SyG0xsFY=; b=YnWTd1d8aGqJ PWk9A7hQNXQv5Tngw3QeBiwgQLiqDhPbOi9p6qtH4VGxEoL6hmml+gffYAWxM5cHe8NAeM9iYi/CA oSUthTiRpTtPj0Ttp3afbmIzS8pzFs/1uiq7UceudY7FUPfL5WS3lg/ViyMJsYCbsQbrg3GmwujVd 2GtlgzZMqYQ56AobZuyHxe6Jj4YiGEGgFPoVzOx/nvbHZkvLvpSCoYR/Drf8qX1MRrY6Xv/EPq3UY oNvxxkM93WUjlPeqqX/JdwyzmYA6AVNPSKlROSG8eiA5y9AiFA9EQqX2y1TDvyP4jnZirSMJFmHbx cRTtERd8/p0f9jD61FWYcA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLnfQ-0001N6-S6; Sat, 28 Jan 2023 11:03:01 -0500 In-Reply-To: (message from martin rudalics on Sat, 28 Jan 2023 16:35:52 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:302720 Archived-At: > Date: Sat, 28 Jan 2023 16:35:52 +0100 > Cc: tgbugs@gmail.com, emacs-devel@gnu.org, larsi@gnus.org > From: martin rudalics > > > I'm not sure what are your recommendations regarding the feature > > installed as result of that discussion. Would you mind spelling them > > out? > > Most of it has been said back then in this dialogue: It's a very long discussion. Just reading all of it takes time, let alone understanding all that you two have been considering. I hoped you could help me do this more efficiently. > >> This > >> > >> + (when-let ((window (display-buffer-use-some-window > >> + buffer (cons (cons 'inhibit-same-window t) alist)))) > >> + (window-bump-use-time window))) > >> > >> alone will bump the use time for a _reused_ window only. A freshly > >> popped up window will continue to be the first candidate for reuse and > >> only then enter the cycle of windows to reuse. > > > > How do we bump the use to for a new window, then? > > By bumping the time stamp of _any_ window 'display-buffer' uses for > displaying a buffer (just like XEmacs does). > > >> XEmacs treats _all_ windows it creates or uses equal in this regard > >> including those on other frames. > > > > Oh, other frames, too... I think we'll leave that as an exercise for > > the reader. > > Then when you switch from one frame to another, any problems you've > found on the previous frame will immediately reemerge on the new frame. > > We need a way to bump the time stamp of _any_ window used. Sorry, I don't understand what that means in practice. Specifically, what do you mean by "any window used"? used by whom and under what circumstances? or do you mean any window that is currently displayed on all the frames? > Otherwise, > the various action functions will continue to fight each other. Lars > wanted to go the way XEmacs did but stopped in the middle. And XEmacs > uses > > (if (window-buffer window) > (save-excursion > (save-selected-window > (select-window window) > (record-buffer (window-buffer window))))) > > to bump the use time of every window used by 'display-buffer'. You mean, do this every time display-buffer is called and selects some window? But that would change our behavior for all the callers of display-buffer, whose names is a legion. Whereas the intent was to provide an optional feature that hopefully doesn't affect any existing behaviors. > > Would it work to just temporarily select the window inside > > display-buffer-use-least-recent-window, so that its use time is bumped > > without any sneaky primitives? Then we could remove > > window-bump-use-time. > > As Lars conceived it, independent 'display-buffer' calls should be able > to build on previous ones. Otherwise, we could write a function like > 'display-many-buffers-at-once', within that function mark all windows > used as temporarily dedicated to their buffers, and at the end restore > the previous dedicated states of these windows. Obviously, a function > like 'display-many-buffers-at-once' would not qualify as buffer display > action function. What do you mean by "independent calls"? Or what are "dependent calls" for this purpose? Without understanding that, I cannot see how what you wrote here answers my question, sorry.