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.

1
  • 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, 2015 at 17:29

2 Answers 2

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'"
2
  • Is there a similar option for list-buffers?
    – taranaki
    Aug 15, 2022 at 17:37
  • @taranaki -- how about M-x buffer-menu-other-window or M-x buffer-menu
    – lawlist
    Aug 15, 2022 at 20:48
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)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.