GNU bug report logs - #74246
[PATCH] Reuse display windows in image-dired

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Thu, 7 Nov 2024 20:25:01 UTC

Severity: normal

Tags: patch

Full log


Message #20 received at 74246 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 74246 <at> debbugs.gnu.org, stefankangas <at> gmail.com,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Thu, 28 Nov 2024 10:28:23 +0100
> I initially explored this option but was weary to use
> 'find-file-noselect-1` as it looks like it should be an internal
> function and is used only in the file it's defined in.

You're right.  Which means that we should try to "promote" and document
that function.  Let's see whether people see any problems with it.

> However, I do like this solution the most.  Attached is a patch almost
> identical to the proposed function.  The proposed function would be
> perfect if it contained the line '(display-buffer buffer t)'.

I'm currently investigating (in the context of Bug#74361) the
possibility to provide an option for reusing a window that already has
shown a related buffer.  'image-dired-display-next' would indirectly
pass that "option" to 'display-buffer' and the latter would try to find
an appropriate window with the help of a window parameter reserved for
that purpose.

Below are ways to implement that "option".  Common to all of them is
that 'display-buffer' sets up a window parameter for the first window
used to display such a buffer and 'display-buffer' would search for a
window with the corresponding value ('image-dired' in this case) for
that parameter.  And the parameter would stay with the window until it
is explicitly reset or the window gets collected.

- 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.

- 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.

- 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.

- 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.

Adding Juri to the discussion.

martin




This bug report was last modified 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.