From efe599df3127bea4c6251ce20513945fdd947c26 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 23 Nov 2022 04:16:23 +0200 Subject: [PATCH] Add a way to override project name for project-vc backend * lisp/progmodes/project.el (project-vc-name): New user option. (project-name): Override for VC project backend (bug#48747). --- lisp/progmodes/project.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 751e240a56e..c7b2c386ccd 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -395,6 +395,15 @@ you might have to restart Emacs to see the effect." :version "29.1" :safe #'booleanp) +(defcustom project-vc-name nil + "When non-nil, the name of the current VC project. + +The best way to change the value a VC project reports as its +name, is by setting this in .dir-locals.el." + :type 'string + :version "29.1" + :safe #'stringp) + ;; FIXME: Using the current approach, major modes are supposed to set ;; this variable to a buffer-local value. So we don't have access to ;; the "external roots" of language A from buffers of language B, which @@ -694,6 +703,10 @@ DIRS must contain directory names." (push buf bufs))) (nreverse bufs))) +(cl-defmethod project-name ((_project (head vc))) + (or project-vc-name + (cl-call-next-method))) + ;;; Project commands -- 2.39.5