When I open a man page (e.g.
M-x man cat) I would like to automatically move my cursor onto the man page. I already know how to achieve this behavior for
*Apropos*, and I want to get the same behavior for Man mode too. I have tried this:
(add-hook 'Man-mode-hook (lambda () (pop-to-buffer (current-buffer))))
This works when opening a man page for the first time. However, when opening the same man page a second time, the Man window will be shown, but the cursor will not be moved to it. For example, if I do
M-x man cat for the first time, the man page for "cat" will be shown and the cursor will be moved to it. However, if I delete the man page window (
C-x 0) and ask for the same man page again (
M-x man cat), the man page for "cat" will be shown, but the cursor will not be moved to it.
How do I automatically select the Man mode buffer when it is shown?