From 0cab6351832d8e81ddad89bee15cf7c6d29cc1dd Mon Sep 17 00:00:00 2001 From: David Morgan Date: Fri, 26 Aug 2022 16:12:57 +0100 Subject: Include more of the path in clj buffer names --- .emacs.d/lisp/init-clojure.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to '.emacs.d/lisp') 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 -- cgit 1.4.1-2-gfad0