So I know that Man-notify-method controls this, but I like to have the option to open it in the same window. By default, I have it to pushy. Currently, I have:
(global-set-key (kbd "H-m s") 'man)
and I would like to have
(global-set-key (kbd "H-m o") 'man-other-window)
I am very new to Elisp, but I think it should be something as simple as:
(defun man-other-window ()
"open a `man` in a new window."
(interactive)
(let ((Man-notify-method 'friendly))
(man)))
but I get an error to do with wrong number of arguments, but when I pass an argument to the function, it doesn't work the way I like it. How can I get the behavior so that it would behave as:
M-x man-other-window RET relevant-man-page RET
just as M-x man does?
If you're using >= Emacs 28.1, as the simplest solution, try using
other-window-prefixcommand, which is bound to C-x 4 4 by default.Namely:
Display next command buffer in a new window...message.manRET<command-name>.The conveniency of
other-window-prefixis that it could be used on-the-fly in many situations, without a need to write functions for all the cases you might encounter.C-h f
other-window-prefixnow outputs the following docstring:For the similar conveniency bindings consult M-:
(info "(emacs) Pop Up Window"). Notably,same-window-prefixis bound to C-x 4 1.