In message hcs1xjcgdm9.fsf@faun.nada.kth.se, Björn Lindberg writes: [...snip...]
And now it works like this: If there is only one window, split into two, and pop up the hyperspec in the newly created one. Otherwise if there is more than one window, pop up the hyperspec in the other window.
It sort of works the way I had in mind, so I'm going to try it for a while, although now I'm thinking that I'd like to have it check for other frames too, and if present open the hyperspec in another frame instead. I suspect the "right" behaviour for these things depend a lot on how you use Emacs, ie how many frames and windows you use, and wether you use the same emacs session for both Slime as well as other activities.
I also have a solution I use. Mine opens the hyperspec in a new window if w3m has no buffers open, otherwise it uses the already existing w3m buffer and window. I explicitly turn pop-up-frames OFF. Combine that with the previous suggestions, and you should be closer to the "ideal". ---
(require 'w3m)
(defun w3m-browse-url-other-window (url &optional newwin) (interactive (browse-url-interactive-arg "w3m URL: ")) (let ((pop-up-frames nil)) (switch-to-buffer-other-window (w3m-get-buffer-create "*w3m*")) (w3m-browse-url url)))
;; The ftp stuff is irrelevant for this discussion. I left it in anyhow. (setq browse-url-browser-function (list (cons "^ftp:/.*" (lambda (url &optional nf) (call-interactively #'find-file-at-point url))) (cons "." #'w3m-browse-url-other-window)))