From ae4de7044ff4b9a54d2c81d1dba81542e3eb17b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= Date: Sun, 23 Mar 2025 21:35:32 -0600 Subject: [PATCH] Add 'project-customize-dirlocals' * etc/NEWS: Add command entry. * lisp/menu-bar.el (menu-bar-project-menu): Add command entry to project menu. * lisp/progmodes/project.el (project-customize-dirlocals): New command. (Bug#77229) (cherry picked from commit da6da5744b95451bdc3339c3a241892466a08551) --- lisp/menu-bar.el | 1 + lisp/progmodes/project.el | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f79de0fa449..e231b125025 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1824,6 +1824,7 @@ mail status in mode line")) (define-key menu [project-compile] '(menu-item "Compile..." project-compile :help "Invoke compiler or Make for current project, view errors")) (define-key menu [separator-project-programs] menu-bar-separator) (define-key menu [project-switch-project] '(menu-item "Switch Project..." project-switch-project :help "Switch to another project and then run a command")) + (define-key menu [project-customize-dirlocals] '(menu-item "Customize Directory Local Variables" project-customize-dirlocals :help "Customize current project Directory Local Variables.")) (define-key menu [project-vc-dir] '(menu-item "VC Dir" project-vc-dir :help "Show the VC status of the project repository")) (define-key menu [project-dired] '(menu-item "Open Project Root" project-dired :help "Read the root directory of the current project, to operate on its files")) (define-key menu [project-find-dir] '(menu-item "Open Directory..." project-find-dir :help "Open existing directory that belongs to current project")) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 19a77720e80..3721a19d852 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1305,6 +1305,14 @@ The current buffer's `default-directory' is available as part of (interactive) (vc-dir (project-root (project-current t)))) +;;;###autoload +(defun project-customize-dirlocals () + "Run `customize-dirlocals' in current project's root." + (interactive) + (customize-dirlocals + (expand-file-name ".dir-locals.el" + (project-root (project-current t))))) + (declare-function comint-check-proc "comint") ;;;###autoload -- 2.39.5