about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/wpc-misc.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-27T22·49+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-27T22·49+0100
commit1ad6c30accf44671e0257a71f8302d8c268e308d (patch)
treec1ce6a6d4051f162f907ca9ca6639cc76f761d4b /emacs/.emacs.d/wpc/wpc-misc.el
parentbae3ff4378383eb5c91bc7333bb824793d280fe9 (diff)
Reuse helpful-mode buffers when traversing documentation
Instead of scattering helpful-mode buffers, reuse existing buffers when
traversing documentation.

See this blog post for more information:
https://d12frosted.io/posts/2019-06-26-emacs-helpful.html
Diffstat (limited to 'emacs/.emacs.d/wpc/wpc-misc.el')
-rw-r--r--emacs/.emacs.d/wpc/wpc-misc.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el
index 8ef3f2f63ab2..de90a751c4ea 100644
--- a/emacs/.emacs.d/wpc/wpc-misc.el
+++ b/emacs/.emacs.d/wpc/wpc-misc.el
@@ -140,6 +140,14 @@
 ;; alternative to help
 (use-package helpful)
 
+;; If called from an existing helpful-mode buffer, reuse that buffer; otherwise,
+;; call `pop-to-buffer'.
+(setq helpful-switch-buffer-function
+      (lambda (buffer-or-name)
+        (if (eq major-mode 'helpful-mode)
+            (switch-to-buffer buffer-or-name)
+          (pop-to-buffer buffer-or-name))))
+
 ;; Emacs integration with direnv
 (use-package direnv
   :config