about summary refs log tree commit diff stats
path: root/.emacs.d
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-08-26 16:12:57 +0100
committerDavid Morgan <djm_uk@protonmail.com>2022-08-26 16:12:57 +0100
commit0cab6351832d8e81ddad89bee15cf7c6d29cc1dd (patch)
treef6a8ac761355a8788554c8a3658e9373b5b22df9 /.emacs.d
parent5bfb76c9db5be3b74eec2e7a2ef6812eb3a11a71 (diff)
downloaddotfiles-0cab6351832d8e81ddad89bee15cf7c6d29cc1dd.tar.gz
Include more of the path in clj buffer names
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/lisp/init-clojure.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/.emacs.d/lisp/init-clojure.el b/.emacs.d/lisp/init-clojure.el
index a684a97..35a9605 100644
--- a/.emacs.d/lisp/init-clojure.el
+++ b/.emacs.d/lisp/init-clojure.el
@@ -27,7 +27,16 @@
     (PATCH 2)
     (rfn 2)
     (let-routes 1)
-    (context 2)))
+    (context 2))
+
+  ;; Always show more of the path in clj buffer names.
+  ;; Using setq-local in clojure-mode-hook is not enough, as it runs too late
+  (defun clj-uniquify-get-proposed-name (orig base dirname &optional depth original-dirname)
+    (when (and (string= ".clj" (substring base -4))
+               (not (string= "project.clj" base)))
+      (setq-local uniquify-min-dir-content 3))
+    (funcall orig base dirname depth original-dirname))
+  (advice-add 'uniquify-get-proposed-name :around 'clj-uniquify-get-proposed-name))
 
 (use-package hydra)
 (use-package clj-refactor