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: Mon, 2 Dec 2024 12:22:05 +0100 Message-ID: <3a5afa37-0ea1-4183-a563-ecc3067818c2@gmx.at> 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> <87ldwyil8q.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="26318"; 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 Mon Dec 02 12:23:24 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 1tI4WR-0006gZ-4W for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 02 Dec 2024 12:23:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tI4WB-0008QW-6S; Mon, 02 Dec 2024 06:23: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 ) id 1tI4W6-0008Q5-Uh for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2024 06:23: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 1tI4W6-00023h-L6 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2024 06:23: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=DZOrKE4n4EMdvf9VvaxQ0dBPHA6SZA+N0S6FCsBZ5rA=; b=IP1PbdF+5TSjcq1RuVrrIuZz/UvJJyCUW/YSBuGYxNBEcG9sOkJvhueRUR1hW9r+2KidPmAp1vEAXn1in7gHGOy/7N9Dh0gPBLI8r1jqiIEpBD3Ea/oxUbbm/O5PEF+wvfg0s0Jtd1wfAB0025pk/CkSCgw2TBrKbe1naZF0Jhvg7Z2IjgyfODp4jcv6zvab6wRdrrNGQjDDbGTe98EF2xJ7qiOvQRHgTd97PqoBSdoBGKJywSyIF3lOK7QjlJEi6DkstPoP/7z6xn4eREqrtXujhUYDBsyenmv/Z9QR8MuPjCGdVWn3JFMjS1cnB9Hsl3Wnho3EDjBAZFoz7UsaOg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tI4W6-0001oG-41 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2024 06:23: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: Mon, 02 Dec 2024 11:23: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.17331385396875 (code B ref 74246); Mon, 02 Dec 2024 11:23:02 +0000 Original-Received: (at 74246) by debbugs.gnu.org; 2 Dec 2024 11:22:19 +0000 Original-Received: from localhost ([127.0.0.1]:54440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tI4VP-0001mp-A2 for submit@debbugs.gnu.org; Mon, 02 Dec 2024 06:22:19 -0500 Original-Received: from mout.gmx.net ([212.227.17.20]:45185) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tI4VM-0001mX-Dd for 74246@debbugs.gnu.org; Mon, 02 Dec 2024 06:22:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.at; s=s31663417; t=1733138526; x=1733743326; i=rudalics@gmx.at; bh=DZOrKE4n4EMdvf9VvaxQ0dBPHA6SZA+N0S6FCsBZ5rA=; 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=UeiPR64eKmzeG2mz6rtE8yOCD+99lenffsmglLGK098+S8PapDwKcv3iJkETygpN Q6BMWErgo2jPAxV6/JC10fVzXnhd3FOTEfnKvgdryoBufAK2gtkFzReYRNlJlMHpO 0kxzsy7n0Hhq7nLIzlJuVt7lXLloeL2BCXNHvkNA0v+m4fDr/CG6xTjxbiQstaUx0 mm9M0LkXw8sXIntw878c5p7A1FD+DBzZdNSLb/H76FDBD/3MInQMD3Kb5fXX5uC0j ztxW3+HFVz2eSyhavAUfuaysjQzWKMOFq+ciYoJetOqpfOgh3nDjV8B+PNvbWIa8T D9vGmSmgEsm5xIIrmw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from [192.168.31.113] ([212.95.5.101]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MLzBp-1t0GdT2klt-00Ip6w; Mon, 02 Dec 2024 12:22:06 +0100 Content-Language: en-US In-Reply-To: <87ldwyil8q.fsf@mail.linkov.net> X-Provags-ID: V03:K1:JskBfnWUq8YHSYn8emel3TZq5GsFBR9q2osnh/FFD5E3woqygPQ kUzHLYzjH6IUfu7I1I86Gz76ERTTZlZok3fyahIio+vTlU1MZVb/ouDRgDGun9ryMxl1rEy 9AmJKiS+wo1HqLvnS1ZCYRgUAUlzHV0hfVxd0cCTsb2Vv0Wv8YbA2vsKoNVH0yKVC/akddX sqBrPIISx8QWkeMXfvOJg== UI-OutboundReport: notjunk:1;M01:P0:AU3emBABfxY=;eNqH3p6E8/ZKfH+vbIVvF4rZThv LO7M1e4J2ljjKv1+teilxGdDCuLv4ijDVc9Fc38C9PSjxz0B36WFBDIcMKLSDwN1TVJF7oBmS UDaJ4OBQaS3FnWaLiCYQtzfKK+04XCCXvSOk33dkG7qEjfkpembY1C/yv8bDpM8hHHwJbPaQf D4qQr0yjb+oNcd7Mx4DJF6g8mUtDoPzsBON1zqmK2CMgJn6G7Fk4+HPBmtlEnvKrG9RfH4yIN 5vt7pND6aLi+EPJl4UFTtzk9iW9TlZohSOYnZlixrsPJ/4XbMraE8xozt+ZLTzKJZY0uhb/8e 5aUJxUuJp2fg+LIF3j1U+PnObjufeZI8jF15A1Sq7wnJXwghXpzNT79o/2KOPFoeoGX61O/h1 iVQi88trQF0CH6qjF5Atn4KtnnnsGA5CQiwdRhU2leWcYwIfn50M944E7tcNCTeRU0bZCTfly Xl/hoQKGCLUAh+WDDovvPjTWz38gXKo4RHNwI/mUc3lVRXWbDGe5w+GDCz1Q5R7Wn/AdIZSJD 8l8UZpEyBrI8djc3rnn1Qnz2PGxLa78glMhGXu4wa6AJfacmV2jJ65w3APOaJhAwf0TeovveU b2ZseVHDbsu+Ll1/o+Fwugozv9ImoQ3teQs7AgSX0REUxbWVNwRmMZkQvQixuUZE0U06hyVsG BhxJ0JTRleUMnZMcfhSCaAW+i3Ls59L70XdQN+tFOQyzYTbM1r5KxYo8o8LLkvF6oqYLCscd1 sxQnHrefRslxOb2K3Uf5UGPqNY2UoonZruJ8hBf1gHIWBhmae/ieopraVga9Y9Nxqz1cF8eS 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:296308 Archived-At: > 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. Hence we have another motivation to use 'find-file-noselect-1' directly (or maybe something like (defun find-file-noselect-in-buffer (filename buffer &optional nowarn rawfile truename) "Visit file FILENAME in live buffer BUFFER. Replace the contents of BUFFER with the contents of file FILENAME and make BUFFER visiting file FILENAME. The file FILENAME must not be visited by another buffer. BUFFER must not have been be modified. Optional arguments NOWARN and RAWFILE are as for `find-file-noselect'." (setq filename (abbreviate-file-name (expand-file-name filename))) (let* ((truename (abbreviate-file-name (file-truename filename))) (attributes (file-attributes truename)) (number (file-attribute-file-identifier attributes))) (cond ((find-buffer-visiting filename) (error "A buffer is already visting %s" filename)) ((not (buffer-live-p buffer)) (error "%s is not a live buffer" buffer)) ((buffer-modified-p buffer) (error "Buffer %s has been modified" buffer))) (find-file-noselect-1 buffer filename nowarn rawfile truename number))) to avoid that people overwrite a modified 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. martin