Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'

From: Elijah Gabe Pérez <[email-masked]>
Date: Mon, 24 Mar 2025 12:24:53 -0600

Eli Zaretskii <[email-masked]> writes:

>> Date: Mon, 24 Mar 2025 06:45:27 -0300
>> From: Mauro Aranda <[email-masked]>

>>  > +(defun project-customize-dirlocals ()
>>  > +  "Run `customize-dirlocals' in current project's root."
>>  > +  (interactive)
>>  > +  (customize-dirlocals (concat (project-root (project-current t)) 
>> ".dir-locals.el")))
>>  > +

>> Would you change it to use file-name-concat or expand-file-name? From
>> past discussions, I think that using concat for file names is
>> discouraged.

> Yes, but file-name-concat is also not right here.  Please use
> expand-file-name.

Done.

>From feb95a04b34e92bc59611e21eb775d76d219a8cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <[email-masked]>
Date: Sun, 23 Mar 2025 21:35:32 -0600
Subject: [PATCH] Add 'project-customize-dirlocals'

* lisp/menu-bar.el (menu-bar-project-menu): Add new function
entry to project menu.
* lisp/progmodes/project.el (project-customize-dirlocals):
New interactive command. (Bug#77229)
---
 lisp/menu-bar.el          | 1 +
 lisp/progmodes/project.el | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 1685357fab6..6a68ad63a5b 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1830,6 +1830,7 @@ menu-bar-project-menu
     (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 e2cd5bfa231..56e72caae1d 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1391,6 +1391,12 @@ project-vc-dir
   (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.49.0

-- 
                                          - E.G via GNU Emacs and Org.