From 1d91d9b717df1781c07d28f46af4ac2af19c16b4 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 8 Jun 2026 15:35:42 +0100 Subject: [PATCH] project-vc-dir: Use truenames * lisp/progmodes/project.el (project-vc-dir): When called interactively, call file-truename on the project root first. * etc/NEWS: Document the change. --- etc/NEWS | 10 ++++++++++ lisp/progmodes/project.el | 14 ++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 1b5bd471cb8..ec440d927dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -70,6 +70,16 @@ check out the repository to prepare a patch for the package maintainer. --- *** Messages from Ansible are now recognized. +** Project + +--- +*** 'C-x p v' ('project-vc-dir') uses the truename of the project root. +'C-x v d' already did this when used interactively. So e.g. if 'link/' +is a symbolic link to 'target/', then 'C-x v d link/ RET' is the same as +'C-x v d target/ RET'. Now the same is true for 'C-x p v', so that if +the project root is a symbolic link, 'C-x p v' first finds the truename +of the directory named by that link, and then opens VC-Dir there. + * New Modes and Packages in Emacs 32.1 diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 7e794330b1f..23c6b913af0 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1608,10 +1608,16 @@ The current buffer's `default-directory' is available as part of (dired (project-root (project-current t)))) ;;;###autoload -(defun project-vc-dir () - "Run VC-Dir in the current project's root." - (interactive) - (vc-dir (project-root (project-current t)))) +(defun project-vc-dir (&optional truenameize) + "Run VC-Dir in the current project's root. +If TRUENAMEIZE is non-nil, as it is interactively, then if the project +root is a symbolic link, resolve it first. This matches the behaviour +of \\[vc-dir] when invoked interactively." + (interactive "p") + (let ((root (project-root (project-current t)))) + (vc-dir (if truenameize + (abbreviate-file-name (file-truename root)) + root)))) ;;;###autoload (defun project-customize-dirlocals ()