I often use Emacs' help buffers, via e.g. C-h k.

Buffer *Help* is displayed in another window, and that window is not selected. In order to close the *Help* buffer, I need to switch windows via C-x o and then press q to close the *Help* buffer.

The solution of always opening the *Help* buffer in the current window, described here, almost works. But I would rather open the help in a different window.

Is it possible to close the *Help* buffer without moving to it, or to set it so that the cursor appears in the help buffer (which would mean I would just need to type q to exit)?

5 Answers 5


You can automatically have the *Help* window be selected when it is displayed, by customizing option help-window-select.

help-window-select is a variable defined in help.el. Its value is t

Original value was nil


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 if and only if it appears on the previously selected frame, that frame contains at least two other windows and the help window is either new or showed a different buffer before.

  • always (t) -- Always select the help window.

If this option is non-nil and the help window appears on another frame, then give that frame input focus too. Note also that if the help window appears on another frame, it may get selected and its frame get input focus even if this option is nil.

This option has effect if and only if the help window was created by with-help-window.

You can customize this variable.


Is it possible to close the *Help* buffer without moving to it

Yes. There's more than one option, but I recommend the following:

  • Add (winner-mode 1) to your init file.
  • Type C-c<left> to call winner-undo to get rid of the *Help* buffer after it pops up.

What this actually does is restore the previous window configuration and it is a more powerful tool than merely something for dismissing unwanted pop-ups, but it's really handy for doing that too.

See C-hig (emacs)Window Convenience for more information.


I have written an elisp function for this. It cycles through all windows and closes/restores the one that contains a buffer named Help

(defun reset-help-window ()
  "Restore help window to previous state"
  (let ((help-window nil) (windows (window-list)))
    (dotimes (i (length (window-list)))
      (when (equal (buffer-name) "*Help*")
    (setf help-window (nth i windows)))
      (other-window 1))
    (if help-window
    (quit-restore-window help-window)
      (print "No Help window"))))

I stole from scroll-other-window to find the window to close. This works well for me!

EDIT: as @NickD points out, works-for-me is only when there was a single window before help was invoked. @Nselm's function works for any number of window splits

quit-window will call quit-restore-window

(defun my/quit-other ()                                                                                                                              
  "quit e.g. *HELP* buffer without switching to it."                                                                                                                          
  (with-selected-window (other-window-for-scrolling) (quit-window)))


Elsewhere, I've bound SPACE q to close the other window without having to first do C-x o.

(evil-leader/set-key "q" #'my/quit-other)
  • 1
    That works if you have a single window when you open the *Help* buffer, but it won't necessarily work if you have more than one window: it might or it might not - you can't be sure that (other-window-for-scrolling) will give you the one with the *Help* buffer.
    – NickD
    Aug 9, 2022 at 19:23
  • @NickD thanks for pointing that out! I'd thought (other-window-for-scroling) was smarter about what window was most recently changed
    – Will
    Aug 9, 2022 at 23:17

FYI you did say 'close' but if you had multiple windows open visiting multiple buffers and the *Help* (or *Arpopos* or *Occur* or...) buffer opened in window over another buffer you want back, then switch-to-buffer-other-window does that. It defaults to the previous buffer in that window. Or M-p can cycle through other previous buffers.

switch-to-buffer-other-window is by default bound to C-x 4 b

Similar question: https://stackoverflow.com/questions/1212426/how-do-i-close-an-automatically-opened-window-in-emacs/

Your Answer

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

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