From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#74246: [PATCH] Reuse display windows in image-dired Date: Thu, 28 Nov 2024 20:27:08 +0200 Organization: LINKOV.NET Message-ID: <87jzcn1af7.fsf@mail.linkov.net> References: <868qtsmydz.fsf@gnu.org> <86a5dqm9gl.fsf@gnu.org> <06f264c8-b1a1-4a7f-8fe9-1ca58b2343ff@gmx.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13280"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Morgan Smith , Eli Zaretskii , 74246@debbugs.gnu.org, stefankangas@gmail.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 28 19:38:32 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 1tGjPL-0003IC-GS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 Nov 2024 19:38:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGjOz-0006Y4-Fr; Thu, 28 Nov 2024 13:38:09 -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 1tGjOu-0006Ws-CI for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 13:38:04 -0500 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 1tGjOu-0005Xl-1z for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 13:38:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=N2q6epubvy1Z66MIJr9JbJkbtLjuBEcX67EmE7m+kFI=; b=PtUou2G7pENACCSo30mkji9QH2gtgbaiKNq1pbUUQqV+5TkheqyS4UaVpiJVlPOCcWNFdRZazhvWowzh0wDFKVJZiFNPXfeq+QYLUgLqqOIieaxD/i5lnlYrVX+W+54c+jNhDekiKhLF1RE59EyqmDErjNAoUpqejc+T75hfdgJKjjpLpUZzLuvgZPM/vcdx5qM0SyT+Y87NtSc18vyk1MTK47/07QVmsBpkQHQc2X4URNB0y6Z2JjeqYiCwtHXKr2D3yOL3oEY8V7h7eV1RLqyAHHdJ/kJgpWPOX4yjlz53JsPjT4uNsHiMhRtgu4i+VjGBZJwMBF3AB4i6u/l3AQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGjOs-0001kp-Rc for bug-gnu-emacs@gnu.org; Thu, 28 Nov 2024 13:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Nov 2024 18:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74246 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74246-submit@debbugs.gnu.org id=B74246.17328190546683 (code B ref 74246); Thu, 28 Nov 2024 18:38:02 +0000 Original-Received: (at 74246) by debbugs.gnu.org; 28 Nov 2024 18:37:34 +0000 Original-Received: from localhost ([127.0.0.1]:39705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGjOP-0001jh-RY for submit@debbugs.gnu.org; Thu, 28 Nov 2024 13:37:34 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:49161) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGjON-0001jO-9h for 74246@debbugs.gnu.org; Thu, 28 Nov 2024 13:37:31 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 57882FF804; Thu, 28 Nov 2024 18:37:02 +0000 (UTC) In-Reply-To: <06f264c8-b1a1-4a7f-8fe9-1ca58b2343ff@gmx.at> (martin rudalics's message of "Thu, 28 Nov 2024 10:28:23 +0100") X-GND-Sasl: juri@linkov.net 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:296064 Archived-At: > - Use the existing 'category' alist entry like > > (pop-to-buffer buf '(nil (category . image-dired))) > > This was my original idea. The downside of this approach is that if > "category" were used for its already existing purpose (whatever that > is), the new purpose we'd gave it here would side-effect the behavior > for the existing purpose. The drawback of reusing 'category' for other purposes is that all current display-buffer calls that provide a category, will set the window parameter 'category' unnecessarily. OTOH, the drawback of using a separate name is that many calls will have to duplicate the same name as e.g. (display-buffer buffer '(nil (category . image-dired) (parameter . image-dired))) > - Allow for the value of the existing 'some-window' alist entry to be > specified as a string like > > (pop-to-buffer buf '(nil (some-window . "image-dired"))) > > Slightly unnatural, but I see no harm with it. This makes such sense that if it has to find some window then let it be the same some-window from previous calls. But it has the same problem as above that many calls should duplicate the name (display-buffer buffer '(nil (category . image-dired) (some-window . "image-dired"))) > - Use a new alist entry, say "parameter" like > > (pop-to-buffer buf '(nil (parameter . image-dired))) > > More intuitive maybe. People would have to learn about it. An alternative name would be '(group . image-dired)' Still the same problem as above: (display-buffer buffer '(nil (category . image-dired) (group . image-dired))) > - Write a new action function 'display-buffer-use-window-with-parameter' > and use it in conjunction with the previous as > > (pop-to-buffer > buf '(display-buffer-use-window-with-parameter (parameter . image-dired))) > > Probably the most universal approach but people have to learn about a > new action function + alist entry. This is the explicit and easy to understand. But too limiting. display-buffer/pop-to-buffer calls should still use the nil action. So in conclusion it seems better to reuse 'category' in display-buffer-use-some-window. But not to set the window parameter 'category' in window--display-buffer unnecessarily. Instead this window parameter could be set only in display-buffer-use-some-window when failing to find a window with a category. I mean something like this in display-buffer-use-some-window (if (get-window-with-category category 'visible nil not-this-window) (use window with category) ;; otherwise (use lru window by default) (set-window-parameter window 'category (cons category parameter)))