bug#81613: [PATCH] Make vc-dir use display-buffer instead of pop-to-buffer
Protesilaos <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello Juri,
> Date: Thu, 13 Aug 2026 20:57:38 +0300
>
>> I cannot make it work.
>
> Actually, there are 3 separate problems here.
>
> 1. A paren with extra nested level was missing:
>
> (setq display-buffer-alist
> '(((derived-mode . vc-dir-mode)
> (display-buffer-reuse-mode-window
> display-buffer-in-tab)
> (mode . vc-dir-mode))))
Sorry for the mistake! In the original code I was using, the syntax was
correct and after my patch I got it to display in another tab, which is
what I actually want.
> Maybe we need to create a syntax checker for 'display-buffer-alist'?
If there is that, I am happy to test it and report any bugs.
> 2. But still you can't always match mode in 'display-buffer-alist',
> because 'vc-dir' enables 'vc-dir-mode' after displaying the buffer
> for the newly created *vc-dir* buffer.
>
> So until 'vc-dir' will be changed to enable
> 'vc-dir-mode' before displaying the buffer,
> 'display-buffer-alist' can reliably match only
> the buffer name (until a category is added
> to its 'pop-to-buffer' call):
>
> (setq display-buffer-alist
> '(("\\`\\*vc-dir\\*\\'"
> (display-buffer-in-tab))))
Oh, I see now why pop-to-buffer is covered by display-buffer-alist. I
was wrong then in thinking that it was not supported.
In the patch I sent, the 'display-buffer' happens after the mode is set.
I assume that is enough for 'display-buffer-alist' to match the buffer
correctly.
So if we want to match 'derived-mode' then my patch should be updated to
use 'pop-to-buffer' instead of 'display-buffer', or is there something
else?