>> I'm not completely sure I understand the behavior you describe, but >> since you consider it counter-intuitive, it sounds like you might want >> to `M-x report-emacs-bug`. > > IIUC, what Zhiwei Chen described is what happens with: > > (define-key isearch-mode-map (kbd "M-s o") #'(lambda () (interactive) > (call-interactively 'isearch-occur) (pop-to-buffer "*Occur*"))) > > Point moves to the occur buffer after you type M-s o, yet isearch has > not ended, so pressing "n", "p", "q", ... adds these characters to the > search string instead of acting in the occur buffer. > > I'm not sure this is a bug, but it should be possible to avoid that > behavior by checking e.g. in isearch-pre-command-hook that point is > still in the buffer in which isearch started. > And here is a micro-patch to fix that behavior.