diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 13aad9173ae..552bff20c99 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -913,6 +913,7 @@ other kinds of prefix arguments are ignored." ;; The current buffer is a compilation buffer. (current-buffer) (if (and compilation-last-buffer (buffer-name compilation-last-buffer) + (compilation-buffer-p compilation-last-buffer) (or (not other-buffer) (not (eq compilation-last-buffer (current-buffer))))) compilation-last-buffer