GNU bug report logs - #77229
[PATCH] Add 'project-customize-dirlocals'

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Mon, 24 Mar 2025 03:59:01 UTC

Severity: normal

Tags: patch

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77229 in the body.
You can then email your comments to 77229 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 24 Mar 2025 03:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Elijah Gabe Pérez <eg642616 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 24 Mar 2025 03:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add 'project-customize-dirlocals'
Date: Sun, 23 Mar 2025 21:58:26 -0600
[Message part 1 (text/plain, inline)]
Tags: patch

This patch add a new function for use =customize-dirlocals= in projects.
customize-dirlocals by default creates a .dir-locals.el if there is not
one found at current directory, this new function aims to ensure to
create (or open) one at current project root.



[Message part 2 (text/html, inline)]
[0001-Add-project-customize-dirlocals.patch (text/patch, attachment)]
[Message part 4 (text/plain, inline)]
-- 
                                          - E.G via GNU Emacs and Org.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 24 Mar 2025 09:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>,
 77229 <at> debbugs.gnu.org
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 24 Mar 2025 06:45:27 -0300
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:

> Tags: patch
>
> This patch add a new function for use customize-dirlocals in projects.
> customize-dirlocals by default creates a .dir-locals.el if there is
> not one found at current directory, this new function aims to ensure
> to create (or open) one at current project root.

Thanks.  I had that in my original package, but it seems I completely
forgot to add it back then.

>>From 31f1f80668aea33c3f130e792f010a35b1609519 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?El=C3=ADas=20Gabriel=20P=C3=A9rez?= <eg642616 <at> gmail.com>
> 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.

Please mention the Bug#.

> --- 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 (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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 24 Mar 2025 12:58:02 GMT) Full text and rfc822 format available.

Message #11 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: eg642616 <at> gmail.com, 77229 <at> debbugs.gnu.org
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 24 Mar 2025 14:57:35 +0200
> Date: Mon, 24 Mar 2025 06:45:27 -0300
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> 
>  > +(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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 24 Mar 2025 18:26:01 GMT) Full text and rfc822 format available.

Message #14 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77229 <at> debbugs.gnu.org, Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 24 Mar 2025 12:24:53 -0600
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Mon, 24 Mar 2025 06:45:27 -0300
>> From: Mauro Aranda <maurooaranda <at> gmail.com>

>>  > +(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.



[Message part 2 (text/html, inline)]
[0001-Add-project-customize-dirlocals.patch (text/x-patch, attachment)]
[Message part 4 (text/plain, inline)]
-- 
                                          - E.G via GNU Emacs and Org.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 31 Mar 2025 11:27:02 GMT) Full text and rfc822 format available.

Message #17 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77229 <at> debbugs.gnu.org
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 31 Mar 2025 08:26:06 -0300
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>  Date: Mon, 24 Mar 2025 06:45:27 -0300
>  From: Mauro Aranda <maurooaranda <at> gmail.com>
>
>  +(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?= <eg642616 <at> gmail.com>
> 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)

Nit: "Interactive command" sounds redundant.  And I think we leave two
spaces after the period in commit messages too.

> 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)))))

Nit: Rearrange this last line to respect the 80-character limit.


More importantly, I think this new command should be announced in NEWS.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 31 Mar 2025 19:53:02 GMT) Full text and rfc822 format available.

Message #20 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>,
 Eli Zaretskii <eliz <at> gnu.org>
Cc: 77229 <at> debbugs.gnu.org, Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 31 Mar 2025 22:52:16 +0300
On 24/03/2025 20:24, Elijah Gabe Pérez wrote:
>     Yes, but file-name-concat is also not right here. Please use
>     expand-file-name.
> 
> Done.

FWIW, looks good to me.

Waiting for the updated version with the NEWS entry, to install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77229; Package emacs. (Mon, 31 Mar 2025 20:22:02 GMT) Full text and rfc822 format available.

Message #23 received at 77229 <at> debbugs.gnu.org (full text, mbox):

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77229 <at> debbugs.gnu.org,
 Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Mon, 31 Mar 2025 14:21:26 -0600
[Message part 1 (text/plain, inline)]
Dmitry Gutov <dmitry <at> gutov.dev> writes:

> On 24/03/2025 20:24, Elijah Gabe Pérez wrote:
>>     Yes, but file-name-concat is also not right here. Please use
>>     expand-file-name.
>> Done.
>
> FWIW, looks good to me.
>
> Waiting for the updated version with the NEWS entry, to install.

Done, sorry for the delay:

[0001-Add-project-customize-dirlocals.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]

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

Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Tue, 01 Apr 2025 21:01:02 GMT) Full text and rfc822 format available.

Notification sent to Elijah Gabe Pérez <eg642616 <at> gmail.com>:
bug acknowledged by developer. (Tue, 01 Apr 2025 21:01:02 GMT) Full text and rfc822 format available.

Message #28 received at 77229-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77229-done <at> debbugs.gnu.org,
 Mauro Aranda <maurooaranda <at> gmail.com>
Subject: Re: bug#77229: [PATCH] Add 'project-customize-dirlocals'
Date: Wed, 2 Apr 2025 00:00:36 +0300
On 31/03/2025 23:21, Elijah Gabe Pérez wrote:
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
> 
>> On 24/03/2025 20:24, Elijah Gabe Pérez wrote:
>>>      Yes, but file-name-concat is also not right here. Please use
>>>      expand-file-name.
>>> Done.
>>
>> FWIW, looks good to me.
>>
>> Waiting for the updated version with the NEWS entry, to install.
> 
> Done, sorry for the delay:

Thanks! Now pushed to master: 
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=da6da5744b95451bdc3339c3a241892466a08551




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Apr 2025 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.