Help windows
Add this to your init.el to automatically focus any help window you see. Then, you'll be able to quit it with Q.
(setq help-window-select t) ; Switch to help buffers automatically
Alternatively, if you're using use-package, I recommend adding this to your init.el (or appending to an existing (use-package emacs ...
declaration):
(use-package emacs
:custom
(help-window-select t "Switch to help buffers automatically"))
This does not change it for other buffers, such as the buffer that opens when you run pp-macroexpand-last-sexp, though.
Automatically switch focus to new windows when you make them
Add this block of code which I copied from the witchmacs repository:
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
Alternatively, if you're using use-package, I recommend not adding (global-set-key...)
to your config and using
(use-package emacs
:bind (:map ctl-x-map
("2" . split-and-follow-horizontally)
("3" . split-and-follow-vertically)))
You can also put the function definition into :config
.
Changing the behavior globally
Add this to your init.el
(defadvice split-window (after split-window-after activate)
(other-window 1))