Inconsistent indentation rules for define-configuration

  • Done
  • quality assurance status badge
Details
2 participants
  • Bruno Victal
  • Simon Tournier
Owner
unassigned
Submitted by
Bruno Victal
Severity
normal
B
B
Bruno Victal wrote on 6 Mar 2023 13:48
(name . bug-guix)(address . bug-guix@gnu.org)
372a5f84-018c-9cee-ba2c-2b564a3d9e31@makinata.eu
Suspected file: .dir-locals.el


Using 'package' as a field in define-configuration results in inconsistent indentation:

Toggle snippet (15 lines)
(define-configuration/no-serialization mympd-configuration
(package
(file-like mympd) ;;;; <<<<<<<<<<<<<<<<<<<<< notice how it's indented with 2 spaces
"The package object of the myMPD server."
empty-serializer)

(shepherd-requirement
(list-of-symbol '()) ;;;; <<<<<<<<<<<<<<<<<<<<< vs 1 space
"This is a list of symbols naming Shepherd services that this service
will depend on."
empty-serializer)

;; ...
)
S
S
Simon Tournier wrote on 7 Mar 2023 14:16
86ilfcbt12.fsf@gmail.com
Hi,

Cool you had the number 62000. ;-)

On Mon, 06 Mar 2023 at 12:48, Bruno Victal <mirai@makinata.eu> wrote:
Toggle quote (22 lines)
> Suspected file: .dir-locals.el
>
> Using 'package' as a field in define-configuration results in
> inconsistent indentation:
>
> --8<---------------cut here---------------start------------->8---
> (define-configuration/no-serialization mympd-configuration
> (package
> (file-like mympd) ;;;; <<<<<<<<<<<<<<<<<<<<< notice how it's indented with 2 spaces
> "The package object of the myMPD server."
> empty-serializer)
>
> (shepherd-requirement
> (list-of-symbol '()) ;;;; <<<<<<<<<<<<<<<<<<<<< vs 1 space
> "This is a list of symbols naming Shepherd services that this service
> will depend on."
> empty-serializer)
>
> ;; ...
> )
> --8<---------------cut here---------------end--------------->8---

What do you mean by inconsistent? Do you think that
’sheperd-requirement’ should be management by .dir-locals.el?

Well, .dirl-locals.el does not consider the context, IIUC.

For instance,

(let ((package something))
(package
()
)
)

Because of .dir-locals.el, the rules looks like that:

(not-in-dir-locals.el
()
)

(package
()
)

(package/inherit
()
()
)

(add-before
()
()
()
)

(let-keywords
()
()
()
()
)

Or you can see that differently,

(not-in-dir-locals.el ()
()
)

(package ()
()
)

(package/inherit ()
()
)

(add-before () ()
()
)


Well, since ’sheperd-requirement’ is not in .dir-locals.el, the
indentation seems expected. What do you consider as a bug?

Cheer,
simon
B
B
Bruno Victal wrote on 7 Mar 2023 14:54
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)(address . 62000@debbugs.gnu.org)
cd0c7b2b-b0c8-7c82-9558-7561183fdc9e@makinata.eu
Hi Simon,

On 2023-03-07 13:16, Simon Tournier wrote:
Toggle quote (30 lines)
> Hi,
>
> Cool you had the number 62000. ;-)
>
> On Mon, 06 Mar 2023 at 12:48, Bruno Victal <mirai@makinata.eu> wrote:
>> Suspected file: .dir-locals.el
>>
>> Using 'package' as a field in define-configuration results in
>> inconsistent indentation:
>>
>> --8<---------------cut here---------------start------------->8---
>> (define-configuration/no-serialization mympd-configuration
>> (package
>> (file-like mympd) ;;;; <<<<<<<<<<<<<<<<<<<<< notice how it's indented with 2 spaces
>> "The package object of the myMPD server."
>> empty-serializer)
>>
>> (shepherd-requirement
>> (list-of-symbol '()) ;;;; <<<<<<<<<<<<<<<<<<<<< vs 1 space
>> "This is a list of symbols naming Shepherd services that this service
>> will depend on."
>> empty-serializer)
>>
>> ;; ...
>> )
>> --8<---------------cut here---------------end--------------->8---
>
> What do you mean by inconsistent? Do you think that
> ’sheperd-requirement’ should be management by .dir-locals.el?

It's not 'shepherd-requirement' that should be managed by .dir-locals.el, it could have been named something else.

Compare with 'mympd-ip-acl':

Toggle snippet (10 lines)
(define-configuration/no-serialization mympd-ip-acl
(allow
(list-of-string '())
"Allowed IP addresses.")

(deny
(list-of-string '())
"Disallowed IP addresses."))

It's uniformly indented.

Toggle quote (3 lines)
> Well, since ’sheperd-requirement’ is not in .dir-locals.el, the
> indentation seems expected. What do you consider as a bug?

Having a field named 'package' within define-configuration causes incorrect indentation.


Cheers,
Bruno.
S
S
Simon Tournier wrote on 7 Mar 2023 15:02
(name . Bruno Victal)(address . mirai@makinata.eu)(address . 62000@debbugs.gnu.org)
CAJ3okZ3NSRQ8v2mudKuVj+newWDDebneq4epPQnH0wkQZseQOA@mail.gmail.com
Hi Bruno,

On Tue, 7 Mar 2023 at 14:54, Bruno Victal <mirai@makinata.eu> wrote:

Toggle quote (2 lines)
> Having a field named 'package' within define-configuration causes incorrect indentation.

As I tried to explain, .dir-locals.el does not consider the context
but only the keyword 'package'. Because of

(eval . (put 'package 'scheme-indent-function 0))

each time the word 'package' appears, then it applies the rule. Maybe
I am missing something but from my point of view, it would not be
possible to change what you are suggesting: apply indentation rules
depending on the context.

Cheers,
simon
B
B
Bruno Victal wrote on 22 Jun 2023 15:40
Re: Inconsistent indentation rules for define-configuration
(address . 62000-done@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
826c18cf-3920-ba04-c7b6-f95ff0f88310@makinata.eu
Hi Simon,

On 2023-03-07 14:02, Simon Tournier wrote:
Toggle quote (3 lines)
> I am missing something but from my point of view, it would not be
> possible to change what you are suggesting: apply indentation rules
> depending on the context
Thanks for the explanation, am closing this then.


--
Furthermore, I consider that nonfree software must be eradicated.

Cheers,
Bruno.
Closed
?