GNU bug report logs - #77228
[PATCH] ; * lisp/cus-edit.el (custom-dirlocals-with-buffer): Use Custom-mode

Previous Next

Package: emacs;

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

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

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77228 AT debbugs.gnu.org.

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#77228; Package emacs. (Mon, 24 Mar 2025 03:47: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:47: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] ; * lisp/cus-edit.el (custom-dirlocals-with-buffer): Use
 Custom-mode
Date: Sun, 23 Mar 2025 21:45:51 -0600
[Message part 1 (text/plain, inline)]
Tags: patch

Little patch for make =customize-dirlocals= use =Custom-mode= instead
=fundamental-mode=, Mostly intended for make this inherit and use
=Custom-mode-hook=.

I have tested it and at the moment it does not cause problems with the
configuration made.



[Message part 2 (text/html, inline)]
[0001-lisp-cus-edit.el-custom-dirlocals-with-buffer-Use-Cu.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#77228; Package emacs. (Mon, 24 Mar 2025 09:34:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>,
 77228 <at> debbugs.gnu.org
Subject: Re: bug#77228: [PATCH] ; * lisp/cus-edit.el
 (custom-dirlocals-with-buffer): Use Custom-mode
Date: Mon, 24 Mar 2025 06:33:40 -0300
Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:

> Tags: patch
>
> Little patch for make customize-dirlocals use Custom-mode instead
> fundamental-mode, Mostly intended for make this inherit and use
> Custom-mode-hook.
>
> I have tested it and at the moment it does not cause problems with the
> configuration made.

Yes, I don't anticipate any real problems, but just using Custom-mode is
almost entirely redundant since some of the settings that it performs
are not relevant, and others get clobbered right away.

Overriden:
custom-mode-map, tool-bar-map, revert-buffer-function.

Not relevant:
custom--invocation-options, custom--hidden-state, custom-options,
custom-local-buffer, widget-edit-functions.

Redundant:
custom--initialize-widget-variables.


That just leaves us with the text-conversion-style and
touch-screen-keyboard-function settings, which my guess is that they
should've been added to custom-dirlocals-with-buffer too, and of course,
running Custom-mode-hook.

So I think it'd be better either to derive from Custom-mode, or find a
way to avoid the redundant settings.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77228; Package emacs. (Thu, 03 Apr 2025 00:27:02 GMT) Full text and rfc822 format available.

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

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 77228 <at> debbugs.gnu.org
Subject: Re: bug#77228: [PATCH] ; * lisp/cus-edit.el
 (custom-dirlocals-with-buffer): Use Custom-mode
Date: Wed, 02 Apr 2025 18:26:08 -0600
[Message part 1 (text/plain, inline)]
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
>
>> Tags: patch
>>
>> Little patch for make customize-dirlocals use Custom-mode instead
>> fundamental-mode, Mostly intended for make this inherit and use
>> Custom-mode-hook.
>>
>> I have tested it and at the moment it does not cause problems with the
>> configuration made.
>
> Yes, I don't anticipate any real problems, but just using Custom-mode is
> almost entirely redundant since some of the settings that it performs
> are not relevant, and others get clobbered right away.
>
> Overriden:
> custom-mode-map, tool-bar-map, revert-buffer-function.
>
> Not relevant:
> custom--invocation-options, custom--hidden-state, custom-options,
> custom-local-buffer, widget-edit-functions.
>
> Redundant:
> custom--initialize-widget-variables.
>
>
> That just leaves us with the text-conversion-style and
> touch-screen-keyboard-function settings, which my guess is that they
> should've been added to custom-dirlocals-with-buffer too, and of course,
> running Custom-mode-hook.
>
> So I think it'd be better either to derive from Custom-mode, or find a
> way to avoid the redundant settings.

But making it derived won't include Custom-mode options anyway?

I made it a major mode but not derived from it.
I've included the Custom-mode options that are useful (as you pointed)
and run Custom-mode-hook.



[Message part 2 (text/html, inline)]
[0001-Create-major-mode-for-customize-dirlocals-bug-77228.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#77228; Package emacs. (Fri, 04 Apr 2025 10:08:01 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 77228 <at> debbugs.gnu.org
Subject: Re: bug#77228: [PATCH] ; * lisp/cus-edit.el
 (custom-dirlocals-with-buffer): Use Custom-mode
Date: Fri, 4 Apr 2025 07:07:15 -0300
On 2/4/25 21:26, Elijah Gabe Pérez wrote: > > Mauro Aranda 
<maurooaranda <at> gmail.com> writes: > > Elijah Gabe Pérez 
<eg642616 <at> gmail.com> writes: > > Tags: patch > > Little patch for make 
customize-dirlocals use Custom-mode instead > fundamental-mode, Mostly 
intended for make this inherit and use > Custom-mode-hook. > > I have 
tested it and at the moment it does not cause problems with the > 
configuration made. > > > Yes, I don't anticipate any real problems, but 
just using Custom-mode is > almost entirely redundant since some of the 
settings that it performs > are not relevant, and others get clobbered 
right away. > > Overriden: > custom-mode-map, tool-bar-map, 
revert-buffer-function. > > Not relevant: > custom–invocation-options, 
custom–hidden-state, custom-options, > custom-local-buffer, 
widget-edit-functions. > > Redundant: > 
custom–initialize-widget-variables. > > > That just leaves us with the 
text-conversion-style and > touch-screen-keyboard-function settings, 
which my guess is that they > should've been added to 
custom-dirlocals-with-buffer too, and of course, > running 
Custom-mode-hook. > > So I think it'd be better either to derive from 
Custom-mode, or find a > way to avoid the redundant settings. > > But 
making it derived won't include Custom-mode options anyway? Yes, but we 
could arrange for Custom-mode to set the right values, I think. Although 
maybe it's not worth it. > I made it a major mode but not derived from 
it. > I've included the Custom-mode options that are useful (as you 
pointed) > and run Custom-mode-hook. Anyway, I'm OK with this. Maybe we 
can use derived-mode-add-parents to be clear that we consider 
Custom-mode a parent of this new mode. Some comments below: >>From 
6510e3f7f68289c99e80426e3c76b8268661fa8a 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:26:26 -0600 > Subject: [PATCH] Create major 
mode for `customize-dirlocals` (bug#77228) > > * lisp/cus-edit.el 
(Custom-dirlocals-mode): New major mode. > 
(custom-dirlocals-with-buffer): Move stuffs to > 
`Custom-dirlocals-mode'. "stuff". > --- > lisp/cus-edit.el | 39 
++++++++++++++++++++++++--------------- > 1 file changed, 24 
insertions(+), 15 deletions(-) > > diff --git a/lisp/cus-edit.el 
b/lisp/cus-edit.el > index ecfce03e490..a0d21fee571 100644 > --- 
a/lisp/cus-edit.el > +++ b/lisp/cus-edit.el > @@ -6060,31 +6060,40 @@ 
custom-dirlocals--set-widget-vars > 
(custom--initialize-widget-variables) > (add-hook 'widget-forward-hook 
#'custom-dirlocals-maybe-update-cons nil t)) > > +(define-derived-mode 
Custom-dirlocals-mode nil "Custom dirlocals" > + "Major mode for 
Customize Directory Local Variables in the current directory." Please 
mention that it runs Custom-mode-hook too. Let's see if somebody else 
has an opinion. I'm on a trip for the weekend, so it won't be until next 
week that I can install this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77228; Package emacs. (Fri, 04 Apr 2025 10:51:02 GMT) Full text and rfc822 format available.

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

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Elijah Gabe Pérez <eg642616 <at> gmail.com>
Cc: 77228 <at> debbugs.gnu.org
Subject: Re: bug#77228: [PATCH] ; * lisp/cus-edit.el
 (custom-dirlocals-with-buffer): Use Custom-mode
Date: Fri, 4 Apr 2025 07:49:55 -0300
[ Resending ]


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

> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>
>  Elijah Gabe Pérez <eg642616 <at> gmail.com> writes:
>
>  Tags: patch
>
>  Little patch for make customize-dirlocals use Custom-mode instead
>  fundamental-mode, Mostly intended for make this inherit and use
>  Custom-mode-hook.
>
>  I have tested it and at the moment it does not cause problems with the
>  configuration made.
>
>  Yes, I don't anticipate any real problems, but just using Custom-mode is
>  almost entirely redundant since some of the settings that it performs
>  are not relevant, and others get clobbered right away.
>
>  Overriden:
>  custom-mode-map, tool-bar-map, revert-buffer-function.
>
>  Not relevant:
>  custom–invocation-options, custom–hidden-state, custom-options,
>  custom-local-buffer, widget-edit-functions.
>
>  Redundant:
>  custom–initialize-widget-variables.
>
>  That just leaves us with the text-conversion-style and
>  touch-screen-keyboard-function settings, which my guess is that they
>  should've been added to custom-dirlocals-with-buffer too, and of course,
>  running Custom-mode-hook.
>
>  So I think it'd be better either to derive from Custom-mode, or find a
>  way to avoid the redundant settings.
>
> But making it derived won't include Custom-mode options anyway?

Yes, but we could arrange for Custom-mode to set the right values, I
think. Although maybe it's not worth it.

> I made it a major mode but not derived from it.
> I've included the Custom-mode options that are useful (as you pointed)
> and run Custom-mode-hook.

Anyway, I'm OK with this. Maybe we can use derived-mode-add-parents to
be clear that we consider Custom-mode a parent of this new mode. Some
comments below:

> * lisp/cus-edit.el (Custom-dirlocals-mode): New major mode.
> (custom-dirlocals-with-buffer): Move stuffs to
> `Custom-dirlocals-mode'.

"stuff".

> +(define-derived-mode Custom-dirlocals-mode nil "Custom dirlocals"
> +  "Major mode for Customize Directory Local Variables in the current 
directory."

Please mention that it runs Custom-mode-hook too.


Let's see if somebody else has an opinion. I'm on a trip for the
weekend, so it won't be until next week that I can install this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77228; Package emacs. (Sat, 05 Apr 2025 04:41:02 GMT) Full text and rfc822 format available.

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

From: Elijah Gabe Pérez <eg642616 <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 77228 <at> debbugs.gnu.org
Subject: Re: bug#77228: [PATCH] Create major mode for `customize-dirlocals`
Date: Fri, 04 Apr 2025 22:39:59 -0600
[Message part 1 (text/plain, inline)]
Mauro Aranda <maurooaranda <at> gmail.com> writes:

>> I made it a major mode but not derived from it.
>> I've included the Custom-mode options that are useful (as you pointed)
>> and run Custom-mode-hook.
>
> Anyway, I'm OK with this. Maybe we can use derived-mode-add-parents to
> be clear that we consider Custom-mode a parent of this new mode. Some
> comments below:
>
>> * lisp/cus-edit.el (Custom-dirlocals-mode): New major mode.
>> (custom-dirlocals-with-buffer): Move stuffs to
>> `Custom-dirlocals-mode'.
>
> "stuff".
>
>> +(define-derived-mode Custom-dirlocals-mode nil "Custom dirlocals"
>> +  "Major mode for Customize Directory Local Variables in the current directory."
>
> Please mention that it runs Custom-mode-hook too.

Done.

[0001-Create-major-mode-for-customize-dirlocals-bug-77228.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
> Let's see if somebody else has an opinion. I'm on a trip for the
> weekend, so it won't be until next week that I can install this.

Don't worry, take your time.

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

This bug report was last modified 3 days ago.

Previous Next


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