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))
delete-other-windows
akaC-x 1
ordelete-window
akaC-x 0
-- gnu.org/software/emacs/manual/html_node/emacs/… There is a variablehelp-window-select
for the*Help*
buffer that controls whether you switch to it or not when it is displayed: emacs.stackexchange.com/a/3357/2287 Some, buffers like the*Help*
buffer and the*Backtrace*
buffer already haveq
set up to delete the window if it is selected.display-buffer-alist
using the things like thebuffer-name
to help control how and where windows are displayed. There is no hard set rule and there are exceptions.(setq help-window-select t)
.