>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. I checked #67993, used the patch, and the *Compile-Log* buffer was selected successfully without the error. If #67993 is implemented, I'll use display-buffer-alist. Otherwise I'll modify bytecomp.el without using display-buffer-alist. I figured out that the post-command-hook is useful.