pop-to-buffer is essentially
display-buffer with selecting the chosen window afterwards.
You can influence the behavior of
display-buffer with display actions specified in several variables. See the corresponding info page for a complete list of actions and variables.
I think you should configure
display-buffer-base-action with your preferred display behavior.
display-buffer-reuse-window with the alist
(reusable-frames . 0) avoids popping up the buffer in the already selected frame if it is shown on another frame.
Configure it with the following Elisp snippet in your config files or use M-x
(setq display-buffer-base-action '(display-buffer-reuse-window (reusable-frames . 0)))
The list of available options for the
reusable-frames entry of the alist is:
- nil: the selected frame (actually the last non-minibuffer frame)
- A frame : just that frame
- ‘visible’: all visible frames
- 0 : all frames on the current terminal
- t : all frames.