8

When I type C-h m for describe-mode the frame splits into two windows with the current buffer on top and the *Help* buffer below. But the focus stays in the current buffer, so I usually have to type C-x o to move focus to the *Help* buffer, and then scroll down with the page-down key to find what I am looking for.

I tried to improve this work flow by automatically give focus to the *Help* buffer:

(advice-add 'describe-mode :after 'other-window)

But now I get error:

Debugger entered--Lisp error: (wrong-type-argument stringp 1)

when I type C-h m.

Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51
  • 1
    For future reference, the error you were seeing is because `other-window` expects a number argument (COUNT). When you use `:after`, the advice function gets passed the same arguments as the function being advised. In this case it was being passed a mode name, causing the wrong-type error. You could use a lambda to call `(other-window 1)`, or call it interactively as you did in your answer. – glucas Jan 17 '15 at 17:29

2 Answers2

14

Customize the variable help-window-select:

    "Non-nil means select help window for viewing.
Choices are:
 never (nil) Select help window only if there is no other window
             on its frame.
 other       Select help window unless the selected window is the
             only other window on the help window's frame.
 always (t)  Always select the help window.

This option has effect if and only if the help window was created
by `with-help-window'"
lawlist
  • 18,826
  • 5
  • 37
  • 118
1

Forgot to use call-interactively on other-window. This seems to work better:

(advice-add 'describe-mode :after '(lambda (&rest args) (call-interactively 'other-window)))
Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51