From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>,
Eli Zaretskii <eliz@gnu.org>,
74246@debbugs.gnu.org, stefankangas@gmail.com
Subject: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Mon, 2 Dec 2024 12:22:05 +0100 [thread overview]
Message-ID: <3a5afa37-0ea1-4183-a563-ecc3067818c2@gmx.at> (raw)
In-Reply-To: <87ldwyil8q.fsf@mail.linkov.net>
> 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
next prev parent reply other threads:[~2024-12-02 11:22 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 20:19 bug#74246: [PATCH] Reuse display windows in image-dired Morgan Smith
2024-11-09 11:37 ` Eli Zaretskii
2024-11-09 17:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 12:16 ` Eli Zaretskii
2024-11-28 0:32 ` Morgan Smith
2024-11-28 9:28 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-28 18:27 ` Juri Linkov
2024-11-29 15:53 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-30 18:03 ` Juri Linkov
2024-12-01 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-02 7:42 ` Juri Linkov
2024-12-02 11:22 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-03 7:47 ` Juri Linkov
2024-12-03 8:25 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-03 17:24 ` Juri Linkov
2024-12-04 7:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-04 17:18 ` Juri Linkov
2024-12-05 9:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-05 17:54 ` Juri Linkov
2024-12-06 8:33 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-07 17:13 ` Juri Linkov
2024-12-08 16:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-09 19:16 ` Juri Linkov
2024-12-10 15:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 17:30 ` Juri Linkov
2024-12-11 9:38 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 7:52 ` Juri Linkov
2024-12-12 9:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 16:40 ` Juri Linkov
2024-12-12 17:24 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-12 18:42 ` Juri Linkov
2024-12-13 9:19 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-14 18:19 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a5afa37-0ea1-4183-a563-ecc3067818c2@gmx.at \
--to=bug-gnu-emacs@gnu.org \
--cc=74246@debbugs.gnu.org \
--cc=Morgan.J.Smith@outlook.com \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
--cc=rudalics@gmx.at \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.