GNU bug report logs - #68081
30.0.50; derived-mode and display-buffer-alist

Previous Next

Package: emacs;

Reported by: German Pacenza <germanp82 <at> hotmail.com>

Date: Thu, 28 Dec 2023 13:32:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: germanp82 <at> hotmail.com, 68081 <at> debbugs.gnu.org
Subject: Re: bug#68081: 30.0.50; derived-mode and display-buffer-alist
Date: Sat, 30 Dec 2023 12:12:35 +0200
> Date: Sat, 30 Dec 2023 10:30:40 +0100
> Cc: germanp82 <at> hotmail.com, 68081 <at> debbugs.gnu.org
> From: martin rudalics <rudalics <at> gmx.at>
> 
>  > Thanks.  I tend to document this subtlety, and otherwise leave it
>  > alone.
> 
> This was not an issue when 'display-buffer' was rewritten in 2011.  It
> became an issue when it started to use 'buffer-match-p' in 2022.

I guess it's a problem on the emacs-29 branch as well, then?

> A fairly safe fix would be
> 
> diff --git a/lisp/info.el b/lisp/info.el
> index 51e9eb72edf..e0d35591ee5 100644
> --- a/lisp/info.el
> +++ b/lisp/info.el
> @@ -768,6 +768,12 @@ info
>       ;; of names that might have been wrapped (in emails, etc.).
>       (setq file-or-node
>             (string-replace "\n" " " file-or-node)))
> +
> +  (unless (or buffer (derived-mode-p 'Info-mode))
> +    (setq buffer (get-buffer-create "*info*"))
> +    (with-current-buffer buffer
> +      (Info-mode)))
> +
>     (info-setup file-or-node
>   	      (pop-to-buffer-same-window (or buffer "*info*"))))
> 
> A still conservative but more advanced fix (that should DTRT in the case
> no window can be found) would be
> 
> diff --git a/lisp/info.el b/lisp/info.el
> index 51e9eb72edf..11e228b9bf8 100644
> --- a/lisp/info.el
> +++ b/lisp/info.el
> @@ -768,8 +768,16 @@ info
>       ;; of names that might have been wrapped (in emails, etc.).
>       (setq file-or-node
>             (string-replace "\n" " " file-or-node)))
> -  (info-setup file-or-node
> -	      (pop-to-buffer-same-window (or buffer "*info*"))))
> +
> +  (unless buffer
> +    (if (derived-mode-p 'Info-mode)
> +	(setq buffer "*info*")
> +      (setq buffer (get-buffer-create "*info*"))
> +      (with-current-buffer buffer
> +	(Info-mode))))
> +
> +  (pop-to-buffer-same-window buffer)
> +  (info-setup file-or-node buffer))
> 
>   (defun info-setup (file-or-node buffer)
>     "Display Info node FILE-OR-NODE in BUFFER."
> 
> Otherwise, you could suggest using
> 
> (setq display-buffer-alist '(((derived-mode . Info-mode)
>                                (display-buffer-in-side-window))
> 			     ("*info*" (display-buffer-in-side-window))))
> 
> as a fallback.

Thanks.  Would you recommend any of the above for the emacs-29 branch?
Or are these not safe enough there?




This bug report was last modified 1 year and 211 days ago.

Previous Next


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