Indeed, the problem goes away with emacs -Q. I investigated further and found that the culprit is display-buffer-function being set to popwin:display-buffer. Thus, I can load my current config and evaluate (setq display-buffer-function nil). The problem will disappear. I still think that my patch is the right solution. The current code expects display-buffer to behave in a certain way and Emacs gives us a ton of ways to change that. Thus, we either need to explicitly set the current buffer, or we can do away with trying to make *Occur* read-only. And really, who needs that? Even if we don't set buffer-read-only, the buffer has no self-insert-command bindings, and if you try to C-k the header, it will still say "Text is read-only: #" because there is a read-only text-property. And why shouldn't you delete matches? Thus, as far as I can tell, my change makes the code more robust (no longer depending on display-buffer to work in a particular way) and it has practically no drawbacks.