emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selecting *Compile-log* buffer automatically


From: Juri Linkov
Subject: Re: Selecting *Compile-log* buffer automatically
Date: Sun, 24 Dec 2023 19:28:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>>>>I believe this should be customizable with something like
>>>> 
>>>>  (setopt display-buffer-alist
>>>>   '(("\\*Compile-log\\*" nil (select-window . t))))
>>>
>>> Thank you for the advice, but I tried this and it didn't work.
>>> *Compile-log* buffer isn't selected.
>>> I used emacs 29.1 with no init files loaded.
>> 
>>This feature was discussed in bug#33258 and bug#46034,
>>but not yet implemented.  It should be easy to implement
>>exactly the same way as 'windmove-display-in-direction'
>>selects the old or new window in 'post-command-hook'.
>>Ok, I will post a patch to bug-gnu-emacs.
>
> There seems to be another problem with using display-buffer-alist.
> byte-compile-file repeats byte-compile, display-warning (this uses
> display-buffer)
> for each S-expression. Selecting *Compile-log* buffer before finishing
> byte-compiling the last
> S-expression causes an error. I checked the error using 
>
> (defun select-visible-warning-buffer (_type _message &optional _level
> buffer-name)
>   "Select the visible warning buffer"
>   (unless buffer-name
>     (setq buffer-name "*Warnings*"))
>   (let ((window (get-buffer-window (get-buffer buffer-name))))
>     (if window (select-window window))))
>
> (advice-add 'display-warning :after #'select-visible-warning-buffer)
>
> , and byte-compile causes "Error: End of file during parsing".
>
> display-buffer-alist should affect every display-buffer, so I think
> it leads to the same error.

Indeed, you can't select arbitrary windows in every display-buffer,
because code after every display-buffer expects certain buffers
to be selected.  This was discussed in bug#33258, and the only
possible solution is to select the window when the current command
finishes.  This is implemented in bug#67993.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]