From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74246: [PATCH] Reuse display windows in image-dired Date: Sun, 1 Dec 2024 09:46:18 +0100 Message-ID: References: <868qtsmydz.fsf@gnu.org> <86a5dqm9gl.fsf@gnu.org> <06f264c8-b1a1-4a7f-8fe9-1ca58b2343ff@gmx.at> <87jzcn1af7.fsf@mail.linkov.net> <08f46ed1-e489-4859-8a25-ba7dc4262b95@gmx.at> <87y1108u9k.fsf@mail.linkov.net> Reply-To: martin rudalics Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4033"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Morgan Smith , Eli Zaretskii , 74246@debbugs.gnu.org, stefankangas@gmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 09:47:20 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 1tHfbq-0000tw-Jr for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 09:47:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHfbe-0005OV-A0; Sun, 01 Dec 2024 03:47:06 -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 1tHfbb-0005OD-6X for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 03:47:03 -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 1tHfba-0004RQ-Ur for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 03:47:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=cskvYv61mZSIGHj0UVMovf4XgGAqiS5dakCgkUaIKN0=; b=mHRWbdno1aXskoziaWcmFLcdkXvP4+mUJLOHpa505dHdXwFd5Xw8DpewUF4s2Ea96UM3nyi+z8TACIil/roVk6Wced+2IsKRuY81kzAI4D2Ldgdky3DJLopDTEwzm1wu7XNQKfoxhMibr2xCAh3GJHxaGdE5gEN8Ma6nFzdXhPtXwJv/WvO+qdBc9azy9DdS4WCM38ukNtIPXottzfrhQRa7qFuYHoVsyCaxsCxyDp/2SKBdWdy72a4B+9uj9jDUFBQGb7RPVC/8fKV3AoRbE0YfJpwPevXmg6bdV5IuLpt65X35VCcu258DTpWeZUXZA4iZVzIGEgoPoYfBxOclFQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHfba-0003ay-IX for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 03:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 08:47: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.173304279713761 (code B ref 74246); Sun, 01 Dec 2024 08:47:02 +0000 Original-Received: (at 74246) by debbugs.gnu.org; 1 Dec 2024 08:46:37 +0000 Original-Received: from localhost ([127.0.0.1]:50238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHfbA-0003Zt-Pn for submit@debbugs.gnu.org; Sun, 01 Dec 2024 03:46:37 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:55197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHfb6-0003ZL-Uh for 74246@debbugs.gnu.org; Sun, 01 Dec 2024 03:46:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1733042779; x=1733647579; i=rudalics@gmx.at; bh=cskvYv61mZSIGHj0UVMovf4XgGAqiS5dakCgkUaIKN0=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=Ovm5FCr0Z1sha9kQg0VOJ0NDv61CiucSYpuCtB7jhKkhZAfKlyhn2YzKZ43dGH3y t5XWWDD7WC5qNi6Z1GHP01BdOv799Un3opHTBKB8fqTNIDTwI84xDHQ/+3tJxIJVF UH9qll7+V669ymBL6PyDLrbCfHMkQHksCS7MQ/tg/fJG80jL0M48uIAOCT24g453P XaFLrOTSsvTeZQ5RX8fDXZ4gbdFwqpRq6EaTV3ucEynRAUItywPCxngmmJS5PVwhs Yir7wLoSjuKwEdx0PGnaZMB8U9rSdQchYRXoZVN/8B+MmXvW/w3HbiQBFqftqm8aP Zx42SwBNQW0pG5W5DA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([212.95.5.58]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M5fMe-1tKRXd2UuY-00BAAQ; Sun, 01 Dec 2024 09:46:19 +0100 Content-Language: en-US In-Reply-To: <87y1108u9k.fsf@mail.linkov.net> X-Provags-ID: V03:K1:af5JGX6YmgKKAbjJ4eBtcWp8CEcbDX0pBkOGadqqGPMLfRDtW11 1PvD/4U5MsNWrziLvkS5M0tLHG3Fphe8DZg0nk18rIHe7EQ3x1Z483HY9yoWpc/9xpzxcq1 xRxF62QGvHaGYTsaVX3T+2tWrPVU8s8L0sQVFp26ShrPOaIPbZ3ZYCODR0FssoW08zgprKi TULg1V7VRbZSCSgFdfsXQ== UI-OutboundReport: notjunk:1;M01:P0:8JvrPkVF/rY=;O6rJTSt7JqUjGZx+IB/wUGchbdk zK0NmIeov3VI3UfK6rPVzmU/7OuzzajMlF6jEPoQZmmpE9/u2NTaWnZQrU0/8hoZ3MAM72umo IpUVk13TwH6iGSJQUO5l1O1+OTgKa7hDVLUJqTedwiarAGfMTVqeu+4l/QGYbQClJzdEIkhja Q88wGTWVychXQnhFpnDDuJe1QCxAxBTi04ntBvclHQwxGRVA+8LamQimkZISEDE2vIyeNoafe +2X9LJ1wolnwaS2Wq7xkPjYYUFvdYRiwAPPq+98FtaNJZpci+EppXB7hoh+vqJCJ0zhxa3uvq CEk/jEfMT1qlO1HXhGC9qMCrMBbWHojsI/LD5+gPWWDsWgQEYYFo1x40Yvq51gbrNQ0Bk7c5T 4efWhmk3LbTcSqYOEI6RLgc9lhvi1SG58wTR47yBYCPuh5KHMQDn3DX2kKpjUieCrYaXmKiH/ mFS/7XYLNZ5Nm7pB+KsjTne+TTFvk898pHEP2tV84S880xbGedmqNVccfVFTIlTbF5YVDXKdx T725n08GZnMPBgibrJeNC5sn36ND2brWjHLKKE62EZLFeDbem8IaPxWDaSKYE8YOSkDOYR6gv 7RTp4zm3YCxTC7ekH0DDdOhsga1BWvnAPDKLGv4dEK6VX1YI97zn0TBjsNJuOYOnnhVvYiHxU tLyS6/vNNKOpMLXF43pWVy65ojTAj7yy4b3ukgEB+EEpCXAe0suWIn47X8eI5AT613Ba2SYeq I2uLM38R7iErL5vQPuVlxMmWBh0W+H/rHFdzj6gXKrtJiH4mfa4u8uSacJBqd19qt2lz0JjC 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:296227 Archived-At: > I agree with the need to set the window parameter always. > For example, I often use commands that override the default action > with e.g. windmove-display-up/down, etc. Therefore needed > to add an advice that remembers the last window in the > buffer-local variable: > > (defvar-local display-buffer-last-window nil) Let's define it via DEFVAR_PER_BUFFER in buffer.c and have 'window--display-buffer' always set it. 'display-buffer-use-some-window' then could use it either by default or if it finds a 'some-window' entry whose cdr is nil or t or whatever we want. > This uses the buffer-local variable in the original buffer > because IIUC setting a window parameter like in your patch > can create such a situation that more than one window > will have the same window parameter. Which is no harm per se. But it should be possible to exploit it somehow. >> Another question: Would it make sense to have 'image-dired' do >> >> (display-buffer buf '(nil ((some-window . mru)))) >> >> in a first phase before embarking on a more complex solution? > > This looks like the best immediate solution. Morgan, can you try that? > However, I still like your proposal to use a category instead of lru, > that could be used here later as well. With 'image-dired' 'display-buffer-last-window' wouldn't help. But 'image-dired' could define a mode-local variable, say 'image-dired-last-window', and propose that as 'some-window'. We could make 'some-window-method' accept a live window for that purpose. > But get-mru-window already prevents selecting the selected window > by the arg NOT-SELECTED of get-mru-window in display-buffer-use-some-window: > > ((eq some-window-method 'mru) > (get-mru-window nil nil t)) > = I thought so but was too lazy to countercheck. martin