unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Easy Customization for Directory Local Variables
@ 2023-09-24 13:13 Mauro Aranda
  2023-09-25  2:20 ` Adam Porter
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Aranda @ 2023-09-24 13:13 UTC (permalink / raw)
  To: emacs-devel

I saw a post on reddit about modifying .dir-locals.el using the
Customize interface.  I didn't find anything available, so I coded
something quickly.

The code is at: https://gitlab.com/mauroaranda/cus-dir

Let me know if there could be interest in having something like this,
either in core or in GNU ELPA.  And in any case, I'll appreciate if you
have any comments about it.

(Backup your files if you're going to test it!)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-09-24 13:13 Easy Customization for Directory Local Variables Mauro Aranda
@ 2023-09-25  2:20 ` Adam Porter
  2023-09-25 10:17   ` Mauro Aranda
  0 siblings, 1 reply; 15+ messages in thread
From: Adam Porter @ 2023-09-25  2:20 UTC (permalink / raw)
  To: maurooaranda; +Cc: emacs-devel

Hi Mauro,

Yes, I think this feature is long overdue to be part of Emacs.  Please 
do put it into core if possible.

 From a quick look, my only suggestion is to have the project command be 
named something like `project-edit-dir-local-variables'.

Thanks,
Adam



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-09-25  2:20 ` Adam Porter
@ 2023-09-25 10:17   ` Mauro Aranda
  2023-09-25 14:32     ` [External] : " Drew Adams
  2023-09-25 17:40     ` Juri Linkov
  0 siblings, 2 replies; 15+ messages in thread
From: Mauro Aranda @ 2023-09-25 10:17 UTC (permalink / raw)
  To: Adam Porter; +Cc: emacs-devel

On 24/9/23 23:20, Adam Porter wrote:
 > Hi Mauro,
 >
 > Yes, I think this feature is long overdue to be part of Emacs.  
Please do put it into core if possible.

Nice to hear that :-)

 > From a quick look, my only suggestion is to have the project command 
be named something like `project-edit-dir-local-variables'.

That would mean to add it to project.el.  I'm fine with proposing that
provided the code gets accepted.

 > Thanks,
 > Adam



^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Easy Customization for Directory Local Variables
  2023-09-25 10:17   ` Mauro Aranda
@ 2023-09-25 14:32     ` Drew Adams
  2023-09-25 15:17       ` Mauro Aranda
  2023-09-25 17:40     ` Juri Linkov
  1 sibling, 1 reply; 15+ messages in thread
From: Drew Adams @ 2023-09-25 14:32 UTC (permalink / raw)
  To: Mauro Aranda, Adam Porter; +Cc: emacs-devel@gnu.org

 
>> From a quick look, my only suggestion is to have the project command be named something like `project-edit-dir-local-variables'.
> 
> That would mean to add it to project.el.  I'm fine with proposing that
> provided the code gets accepted.

Are dir-local vars limited to what Emacs
calls a "project"?  I didn't think so.
Emacs's use of the term "project" is more
limited than what a project might be in
general, and even that is, I think, more
limited than what dir-local vars are/imply.

(Just one top-of-the-head opinion, and not
one very knowledgeable about Emacs "projects".)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [External] : Re: Easy Customization for Directory Local Variables
  2023-09-25 14:32     ` [External] : " Drew Adams
@ 2023-09-25 15:17       ` Mauro Aranda
  2023-09-25 16:18         ` Drew Adams
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Aranda @ 2023-09-25 15:17 UTC (permalink / raw)
  To: Drew Adams, Adam Porter; +Cc: emacs-devel@gnu.org

On 25/9/23 11:32, Drew Adams wrote:
 >
 >>> From a quick look, my only suggestion is to have the project 
command be named something like `project-edit-dir-local-variables'.
 >>
 >> That would mean to add it to project.el.  I'm fine with proposing that
 >> provided the code gets accepted.
 >
 > Are dir-local vars limited to what Emacs
 > calls a "project"?  I didn't think so.
 > Emacs's use of the term "project" is more
 > limited than what a project might be in
 > general, and even that is, I think, more
 > limited than what dir-local vars are/imply.
 >
 > (Just one top-of-the-head opinion, and not
 > one very knowledgeable about Emacs "projects".)

The main command, currently called customize-dirlocals, creates a buffer
to edit a .dir-locals.el file under default-directory.  No limitation
about a "project", as handled by project.el, or whatsoever.  At least
that's the goal.

Another command, currently called customize-dirlocals-project, creates
a buffer to edit the .dir-locals.el file that belongs to some "project",
again, as handled by project.el.  I'm not much of a user of project.el
but it's supposed to be handy, since the user might be editing a file
under a subdirectory of a "project" (recognized by project.el) and
decides to edit the .dir-locals.el that belongs to that "project".  So I
can see why it would be desired for such command to be in project.el,
just like commands to customize a specific set of options, or a group,
belong outside cus-edit.el




^ permalink raw reply	[flat|nested] 15+ messages in thread

* RE: [External] : Re: Easy Customization for Directory Local Variables
  2023-09-25 15:17       ` Mauro Aranda
@ 2023-09-25 16:18         ` Drew Adams
  0 siblings, 0 replies; 15+ messages in thread
From: Drew Adams @ 2023-09-25 16:18 UTC (permalink / raw)
  To: Mauro Aranda, Adam Porter; +Cc: emacs-devel@gnu.org

> The main command, currently called customize-dirlocals, creates a buffer
> to edit a .dir-locals.el file under default-directory.  No limitation
> about a "project", as handled by project.el, or whatsoever.  At least
> that's the goal.
> 
> Another command, currently called customize-dirlocals-project, creates
> a buffer to edit the .dir-locals.el file that belongs to some "project",
> again, as handled by project.el.  I'm not much of a user of project.el
> but it's supposed to be handy, since the user might be editing a file
> under a subdirectory of a "project" (recognized by project.el) and
> decides to edit the .dir-locals.el that belongs to that "project".  So I
> can see why it would be desired for such command to be in project.el,
> just like commands to customize a specific set of options, or a group,
> belong outside cus-edit.el

I see.  Sorry for the noise.  I didn't realize
this was really project-specific.  I was thinking
it was what you describe for `customize-dirlocals'.


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-09-25 10:17   ` Mauro Aranda
  2023-09-25 14:32     ` [External] : " Drew Adams
@ 2023-09-25 17:40     ` Juri Linkov
  2023-09-26 22:02       ` Dmitry Gutov
  2023-10-01 13:37       ` Mauro Aranda
  1 sibling, 2 replies; 15+ messages in thread
From: Juri Linkov @ 2023-09-25 17:40 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Adam Porter, emacs-devel

>> Yes, I think this feature is long overdue to be part of Emacs.  Please do
>  put it into core if possible.
>
> Nice to hear that :-)
>
>> From a quick look, my only suggestion is to have the project command be
>  named something like `project-edit-dir-local-variables'.
>
> That would mean to add it to project.el.  I'm fine with proposing that
> provided the code gets accepted.

The most suitable place for this new feature would be files-x.el
where extra commands for dir-local variables are defined.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-09-25 17:40     ` Juri Linkov
@ 2023-09-26 22:02       ` Dmitry Gutov
  2023-10-01 13:37       ` Mauro Aranda
  1 sibling, 0 replies; 15+ messages in thread
From: Dmitry Gutov @ 2023-09-26 22:02 UTC (permalink / raw)
  To: Juri Linkov, Mauro Aranda; +Cc: Adam Porter, emacs-devel

On 25/09/2023 20:40, Juri Linkov wrote:
>>> Yes, I think this feature is long overdue to be part of Emacs.  Please do
>>   put it into core if possible.
>>
>> Nice to hear that 😄
>>
>>>  From a quick look, my only suggestion is to have the project command be
>>   named something like `project-edit-dir-local-variables'.
>>
>> That would mean to add it to project.el.  I'm fine with proposing that
>> provided the code gets accepted.
> The most suitable place for this new feature would be files-x.el
> where extra commands for dir-local variables are defined.

Might as well be both: a new UI for editing dir-locals in any directory 
and a (tiny) new command in project.el which invokes it for the root.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-09-25 17:40     ` Juri Linkov
  2023-09-26 22:02       ` Dmitry Gutov
@ 2023-10-01 13:37       ` Mauro Aranda
  2023-10-01 18:49         ` Juri Linkov
  1 sibling, 1 reply; 15+ messages in thread
From: Mauro Aranda @ 2023-10-01 13:37 UTC (permalink / raw)
  To: Juri Linkov; +Cc: Adam Porter, emacs-devel

On 25/9/23 14:40, Juri Linkov wrote:
 >>> Yes, I think this feature is long overdue to be part of Emacs.  
Please do
 >>  put it into core if possible.
 >>
 >> Nice to hear that :-)
 >>
 >>> From a quick look, my only suggestion is to have the project command be
 >>  named something like `project-edit-dir-local-variables'.
 >>
 >> That would mean to add it to project.el.  I'm fine with proposing that
 >> provided the code gets accepted.
 >
 > The most suitable place for this new feature would be files-x.el
 > where extra commands for dir-local variables are defined.

Would customize-dir-locals be a good name for the command, if it is to
live in files-x.el? What about the other names? files-x.el
doesn't seem to have a prefix, so I'm unsure on how to name them.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-01 13:37       ` Mauro Aranda
@ 2023-10-01 18:49         ` Juri Linkov
  2023-10-02  5:41           ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juri Linkov @ 2023-10-01 18:49 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Adam Porter, emacs-devel

>> The most suitable place for this new feature would be files-x.el
>> where extra commands for dir-local variables are defined.
>
> Would customize-dir-locals be a good name for the command, if it is to
> live in files-x.el?

customize-dir-locals looks nice for the top command - as a blend of
customize-variable and *-dir-locals from files-x.el.

> What about the other names? files-x.el doesn't seem to have a prefix,
> so I'm unsure on how to name them.

There is no single prefix in files-x.el, but still names are quite
consistent.  So you could choose any prefix you think would be
internally consistent between all your new functions and variables.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-01 18:49         ` Juri Linkov
@ 2023-10-02  5:41           ` Eli Zaretskii
  2023-10-02  6:43             ` Juri Linkov
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-10-02  5:41 UTC (permalink / raw)
  To: Juri Linkov; +Cc: maurooaranda, adam, emacs-devel

> From: Juri Linkov <juri@linkov.net>
> Cc: Adam Porter <adam@alphapapa.net>,  emacs-devel@gnu.org
> Date: Sun, 01 Oct 2023 21:49:56 +0300
> 
> >> The most suitable place for this new feature would be files-x.el
> >> where extra commands for dir-local variables are defined.
> >
> > Would customize-dir-locals be a good name for the command, if it is to
> > live in files-x.el?
> 
> customize-dir-locals looks nice for the top command - as a blend of
> customize-variable and *-dir-locals from files-x.el.
> 
> > What about the other names? files-x.el doesn't seem to have a prefix,
> > so I'm unsure on how to name them.
> 
> There is no single prefix in files-x.el, but still names are quite
> consistent.  So you could choose any prefix you think would be
> internally consistent between all your new functions and variables.

Why should this be in files-x.el? why not in custom.el, for example?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-02  5:41           ` Eli Zaretskii
@ 2023-10-02  6:43             ` Juri Linkov
  2023-10-02  7:21               ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Juri Linkov @ 2023-10-02  6:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: maurooaranda, adam, emacs-devel

>> There is no single prefix in files-x.el, but still names are quite
>> consistent.  So you could choose any prefix you think would be
>> internally consistent between all your new functions and variables.
>
> Why should this be in files-x.el? why not in custom.el, for example?

If these functions implement a new customization type then
a good place would be in custom.el indeed.  Only functions
that write the dir-locals file could remain in files-x.el.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-02  6:43             ` Juri Linkov
@ 2023-10-02  7:21               ` Eli Zaretskii
  2023-10-02 10:06                 ` Mauro Aranda
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2023-10-02  7:21 UTC (permalink / raw)
  To: Juri Linkov; +Cc: maurooaranda, adam, emacs-devel

> From: Juri Linkov <juri@linkov.net>
> Cc: maurooaranda@gmail.com,  adam@alphapapa.net,  emacs-devel@gnu.org
> Date: Mon, 02 Oct 2023 09:43:54 +0300
> 
> >> There is no single prefix in files-x.el, but still names are quite
> >> consistent.  So you could choose any prefix you think would be
> >> internally consistent between all your new functions and variables.
> >
> > Why should this be in files-x.el? why not in custom.el, for example?
> 
> If these functions implement a new customization type then
> a good place would be in custom.el indeed.  Only functions
> that write the dir-locals file could remain in files-x.el.

Or how about cus-edit.el?  That's where many/most Customize commands
live.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-02  7:21               ` Eli Zaretskii
@ 2023-10-02 10:06                 ` Mauro Aranda
  2023-10-02 16:51                   ` Juri Linkov
  0 siblings, 1 reply; 15+ messages in thread
From: Mauro Aranda @ 2023-10-02 10:06 UTC (permalink / raw)
  To: Eli Zaretskii, Juri Linkov; +Cc: adam, emacs-devel

On 2/10/23 04:21, Eli Zaretskii wrote:
 >> From: Juri Linkov <juri@linkov.net>
 >> Cc: maurooaranda@gmail.com,  adam@alphapapa.net,  emacs-devel@gnu.org
 >> Date: Mon, 02 Oct 2023 09:43:54 +0300
 >>
 >>>> There is no single prefix in files-x.el, but still names are quite
 >>>> consistent.  So you could choose any prefix you think would be
 >>>> internally consistent between all your new functions and variables.
 >>>
 >>> Why should this be in files-x.el? why not in custom.el, for example?
 >>
 >> If these functions implement a new customization type then
 >> a good place would be in custom.el indeed.  Only functions
 >> that write the dir-locals file could remain in files-x.el.
 >
 > Or how about cus-edit.el?  That's where many/most Customize commands
 > live.

cus-edit.el seems like the better choice for me.  When icons were added,
the functions to customize icons went in there.  The only difference
here is that the new functionality doesn't write to the custom-file,
rather to some .dir-locals.el.

Apart from a function that writes to the .dir-locals-2.el file, all
functions that manipulate the .dir-locals file are from files-x.el.  The
mentioned function is nowhere near smart as modify-dir-local-variable,
but I had to code it since I didn't find that to be supported in
files-x.el.  Maybe modify-dir-local-variable and the like could be
taught to handle .dir-locals-2.el too.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Easy Customization for Directory Local Variables
  2023-10-02 10:06                 ` Mauro Aranda
@ 2023-10-02 16:51                   ` Juri Linkov
  0 siblings, 0 replies; 15+ messages in thread
From: Juri Linkov @ 2023-10-02 16:51 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: Eli Zaretskii, adam, emacs-devel

>> Or how about cus-edit.el?  That's where many/most Customize commands
>> live.
>
> cus-edit.el seems like the better choice for me.  When icons were added,
> the functions to customize icons went in there.  The only difference
> here is that the new functionality doesn't write to the custom-file,
> rather to some .dir-locals.el.

Agreed.

> Apart from a function that writes to the .dir-locals-2.el file, all
> functions that manipulate the .dir-locals file are from files-x.el.  The
> mentioned function is nowhere near smart as modify-dir-local-variable,
> but I had to code it since I didn't find that to be supported in
> files-x.el.  Maybe modify-dir-local-variable and the like could be
> taught to handle .dir-locals-2.el too.

files-x.el could have a new function that only writes settings
either to .dir-locals.el or .dir-locals-2.el, with code refactored
out of modify-dir-local-variable.



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-10-02 16:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-24 13:13 Easy Customization for Directory Local Variables Mauro Aranda
2023-09-25  2:20 ` Adam Porter
2023-09-25 10:17   ` Mauro Aranda
2023-09-25 14:32     ` [External] : " Drew Adams
2023-09-25 15:17       ` Mauro Aranda
2023-09-25 16:18         ` Drew Adams
2023-09-25 17:40     ` Juri Linkov
2023-09-26 22:02       ` Dmitry Gutov
2023-10-01 13:37       ` Mauro Aranda
2023-10-01 18:49         ` Juri Linkov
2023-10-02  5:41           ` Eli Zaretskii
2023-10-02  6:43             ` Juri Linkov
2023-10-02  7:21               ` Eli Zaretskii
2023-10-02 10:06                 ` Mauro Aranda
2023-10-02 16:51                   ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).