Hello, I noticed that 1. if you apply a custom rule to display-buffer-alist for grep, occur or compilation buffers that automatically select its window when the buffer if displayed ; 2. call next-error or previous-error from an error-buffer, 3. compilation-goto-locus will call display-buffer for the compilation buffer 4. the selected-window have now changed, we are in the compilation window, and nonetheless compilation-goto-locus will call switch-to-buffer in this window instead of pop-to-buffer. This patch is a trivial check aknowledge if we are in the compilation window before choosing what display function to use, so users can customize the behavior of compilation windows via display-buffer-alist without breaking the error navigation functionnalities. In GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2021-01-31, modified by Debian built on x86-csail-01 Windowing system distributor 'The X.Org Foundation', version 11.0.12004000 System Description: Debian GNU/Linux 10 (buster) Recent messages: Checking 70 files in /usr/share/emacs/26.1/lisp/erc... Checking 34 files in /usr/share/emacs/26.1/lisp/emulation... Checking 176 files in /usr/share/emacs/26.1/lisp/emacs-lisp... Checking 24 files in /usr/share/emacs/26.1/lisp/cedet... Checking 57 files in /usr/share/emacs/26.1/lisp/calendar... Checking 87 files in /usr/share/emacs/26.1/lisp/calc... Checking 105 files in /usr/share/emacs/26.1/lisp/obsolete... Checking for load-path shadows...done Message modified; kill anyway? (y or n) y