about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2023-08-15 16:37:19 +0100
committerDavid Morgan <djm_uk@protonmail.com>2023-08-15 16:37:19 +0100
commitf04b9afcfc5bbfd03dd872408f9e6c538d123b3d (patch)
tree8c0d87ee2b9b9c5ae3b9dd4322f815e11d8eb7e2
parent258eb955c7e91fb364448f6ca452020f6cb67556 (diff)
downloaddotfiles-f04b9afcfc5bbfd03dd872408f9e6c538d123b3d.tar.gz
Prevent cider-quit from leaving duplicate windows
-rw-r--r--.emacs.d/lisp/init-clojure.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-clojure.el b/.emacs.d/lisp/init-clojure.el
index 6dd16cb..e26a769 100644
--- a/.emacs.d/lisp/init-clojure.el
+++ b/.emacs.d/lisp/init-clojure.el
@@ -154,6 +154,12 @@
         (list beg end (completion-table-dynamic (lambda (_) completion))
               :annotation-function #'cider-annotate-symbol))))
   (advice-add 'cider-complete-at-point :override 'my/cider-complete-at-point)
+
+  (defun fix-duplicate-windows ()
+    "When all windows are the same, delete all of them except the current one."
+    (when (apply #'eq (mapcar 'window-buffer (window-list)))
+      (delete-other-windows)))
+  (advice-add #'cider-close-ancillary-buffers :after #'fix-duplicate-windows)
   :bind
   (:map cider-mode-map
         ("C-c M-l" . cider-load-file)