Subject: Re: bug#68081: 30.0.50; derived-mode and display-buffer-alist

From: Eli Zaretskii <[email-masked]>
Date: Fri, 29 Dec 2023 13:41:36 +0200

> Date: Fri, 29 Dec 2023 10:02:50 +0100
> Cc: [email-masked]
> From: martin rudalics <[email-masked]>
> 
>  >> display-buffer-alist rules that use derived-mode or major-mode are
>  >> ignored on first use.
>  >>
>  >> emacs -Q:
>  >>
>  >> (setq display-buffer-alist '(((derived-mode . Info-mode)
>  >>                                (display-buffer-in-side-window))))
>  >> "C-h i"
>  >> The info buffer takes the whole window
>  >> "q"
>  >> "C-h i"
>  >> The info buffer opens in side window as expected
>  >>
>  >> Info and Compilation modes are affected, but Help and Man work as expected
>  >
>  > Martin, any comments or suggestions?
> 
> C-h i does
> 
>    (info-setup file-or-node
> 	      (pop-to-buffer-same-window (or buffer "*info*"))))
> 
> In the first call BUFFER is nil and the
> 
>                         (provided-mode-derived-p
>                          (buffer-local-value 'major-mode buffer)
>                          mode))
> 
> rigmarole in 'buffer-match-p' won't report a match because the major
> mode of *info* is still fundamental mode.  In later calls the *info*
> buffer exists already, is in Info-mode, and 'buffer-match-p' will
> produce the desired result.
> 
> We could try to call 'Info-mode' _before_ calling 'display-buffer' but
> I'm not sure of the consequences this would have.

Thanks.  I tend to document this subtlety, and otherwise leave it
alone.