From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Juri Linkov <juri@linkov.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Tue, 03 Dec 2024 09:47:15 +0200
Organization: LINKOV.NET
Message-ID: <871pypb43g.fsf@mail.linkov.net>
References: <CH3PR84MB3424D9B5D11B35E8CA3637FFC55C2@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
 <868qtsmydz.fsf@gnu.org> <a4e687f5-487b-4cb1-8dee-7559f5f0796a@gmx.at>
 <86a5dqm9gl.fsf@gnu.org>
 <CH3PR84MB34249702569748082C9BBF9CC5292@CH3PR84MB3424.NAMPRD84.PROD.OUTLOOK.COM>
 <06f264c8-b1a1-4a7f-8fe9-1ca58b2343ff@gmx.at>
 <87jzcn1af7.fsf@mail.linkov.net>
 <08f46ed1-e489-4859-8a25-ba7dc4262b95@gmx.at>
 <87y1108u9k.fsf@mail.linkov.net>
 <a36e24d6-91c9-407b-b961-5f0b8683600e@gmx.at>
 <87ldwyil8q.fsf@mail.linkov.net>
 <3a5afa37-0ea1-4183-a563-ecc3067818c2@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="14585"; 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 <Morgan.J.Smith@outlook.com>, Eli Zaretskii <eliz@gnu.org>,
 74246@debbugs.gnu.org, stefankangas@gmail.com
To: martin rudalics <rudalics@gmx.at>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 03 08:49:13 2024
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1tINei-0003bF-96
	for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 03 Dec 2024 08:49:12 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1tINed-000837-RL; Tue, 03 Dec 2024 02:49:07 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1tINeY-00082w-90
 for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 02:49:02 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1tINeX-0005AX-Vp
 for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 02:49:02 -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=o17n/e/P1GXxAQX9b+0mxMIYGPLWrTJreUVu5MtCQMI=; 
 b=FX+zEAWEZh67FE2UOPyxBIYe/uMc9DkzTRMgltnfb5XrsOc8EXevN1Kpu80ffznFDxrEiJ/mISlWzsMZH9pVvt3C0wtUa8uO8f18Y6mWdqetJ30YHAtPH/VRW9WXbzeDgjR7B4qY+jKfcKdjCIT+mFL0WSkFqZs9479pMJtZ6bV7af2bMrLN7BWB9Sx1KX7JMwvbNnqgRAilZ7RJ3MWhFsZqrtiIQieLvjSZz9KiCnQdaBsnzMy+a8VzA5sTJp6uEIVtMECNic98Y9/sHTGiMcQ6aAel0c6VPLhvwsX/TKIoMC5XnLifqGNZdPWSmnTEExRH2zZ8f7BtNQrwu9tnFw==;
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1tINeX-0006ZR-R3
 for bug-gnu-emacs@gnu.org; Tue, 03 Dec 2024 02:49:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Juri Linkov <juri@linkov.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Tue, 03 Dec 2024 07:49:01 +0000
Resent-Message-ID: <handler.74246.B74246.173321210425195@debbugs.gnu.org>
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.173321210425195
 (code B ref 74246); Tue, 03 Dec 2024 07:49:01 +0000
Original-Received: (at 74246) by debbugs.gnu.org; 3 Dec 2024 07:48:24 +0000
Original-Received: from localhost ([127.0.0.1]:58085 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1tINdw-0006YJ-0W
 for submit@debbugs.gnu.org; Tue, 03 Dec 2024 02:48:24 -0500
Original-Received: from relay5-d.mail.gandi.net ([217.70.183.197]:50285)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@linkov.net>) id 1tINdu-0006Y2-5K
 for 74246@debbugs.gnu.org; Tue, 03 Dec 2024 02:48:22 -0500
Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 6A3151C0006;
 Tue,  3 Dec 2024 07:47:55 +0000 (UTC)
In-Reply-To: <3a5afa37-0ea1-4183-a563-ecc3067818c2@gmx.at> (martin rudalics's
 message of "Mon, 2 Dec 2024 12:22:05 +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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:296356
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/296356>

>> Please explain why 'display-buffer-last-window' wouldn't help
>> for 'image-dired'?  IIUC, 'image-dired' uses one source buffer
>> that could use the buffer-local variable to remember the last
>> window it used to display an image buffer.
>
> Hmm...  Currently 'image-dired-display-image' does
>
>   (let ((buf (get-buffer image-dired-display-image-buffer))
>         (cur-win (selected-window)))
>     (when buf
>       (kill-buffer buf))
>     (when-let ((buf (find-file-noselect file nil t)))
>       (pop-to-buffer buf)
>       (rename-buffer image-dired-display-image-buffer)
>
> so it kills that buffer and its local variables are gone.

It kills the target buffer, not the source buffer?
The idea was to set a buffer-local variable in the source buffer.

> Otherwise, you're right.  The question is now whether
>
> - 'display-buffer-use-some-window' should use the buffer-local value of
>   'display-buffer-last-window' autonomously, or
>
> - get it via a (some-window . display-buffer-last-window) alist entry.
>
> And obviously whether 'display-buffer' should set the value of
> 'display-buffer-last-window' itself or leave that to the caller.
>
> Maybe something like (some-window . t) could be used to incite
> 'display-buffer-use-some-window' to go for the buffer-local value of
> that variable and 'window--display-buffer' to set it.

Or some more meaningful value e.g. (some-window . reuse)