guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feedback on indentation rules


From: Maxim Cournoyer
Subject: Re: Feedback on indentation rules
Date: Wed, 01 Mar 2023 10:17:08 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi Efraim,

Efraim Flashner <efraim@flashner.co.il> writes:

> On Thu, Feb 23, 2023 at 05:20:55PM -0500, Maxim Cournoyer wrote:
>> -CC bug#61255
>> +CC guix-devel
>> 
>> Hi Ludovic and guix-devel readers,
>> 
>> Ludovic Courtès <ludo@gnu.org> writes:
>> 
>> > Hi,
>> >
>> > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>> >
>> >> Ludovic Courtès <ludo@gnu.org> writes:
>> >>
>> 
>> [...]
>> 
>> >>> I’m not convinced by the indentation rule for ‘gexp->derivation’ added
>> >>> in 82daab42811a2e3c7684ebdf12af75ff0fa67b99: there’s no reason to treat
>> >>> ‘gexp->derivation’ differently from other procedures.
>> >>
>> >> The benefit I saw was that writing
>> >>
>> >>  (gexp->derivation the-name
>> >>   #~(begin
>> >>      (the
>> >>        (multi-line
>> >>         (gexp)))))
>> >
>> > I understand, but you know, it’s best to avoid unilaterally changing
>> > established conventions.  :-)
>> >
>> > If and when there’s consensus about this change, (guix read-print)
>> > should be updated.
>> 
>> OK.  I'm not against soliciting more opinions; I'm CC'ing guix-devel,
>> hoping some opinionated individuals tip in on this 2021
>> 82daab42811a2e3c7684ebdf12af75ff0fa67b99 commit, more specifically, the
>> part that change the indentation rules for .dir-locals.el like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>> +   (eval . (put 'gexp->derivation 'scheme-indent-function 1))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> In the same spirit there was also
>> b1c25e2ce364741d1c257d3bb3ab773032807a80 (".dir-locals.el: Add
>> indentation rule for computed-file.") made more recently (last month).
>> 
>> The idea was to be able to format gexp->derivation like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>>           (gexp->derivation "check-deb-pack"
>>             (with-imported-modules '((guix build utils))
>>               #~(begin
>>                   (use-modules (guix build utils)
>>                                (ice-9 match)
>>                                (ice-9 popen)
>>                                (ice-9 rdelim)
>>                                (ice-9 textual-ports)
>>                                (rnrs base))
>> [...]
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Rather than like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>>           (gexp->derivation "check-deb-pack"
>>                             (with-imported-modules '((guix build utils))
>>                               #~(begin
>>                                   (use-modules (guix build utils)
>>                                                (ice-9 match)
>>                                                (ice-9 popen)
>>                                                (ice-9 rdelim)
>>                                                (ice-9 textual-ports)
>>                                                (rnrs base))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> (or having to use another 'builder' variable, for example).
>> 
>> What do you all think?
>
> The second one is waaaay to indented. For myself I sometimes end up
> wrapping the lines (although I don't love it) so it looks like this:
>
>            (gexp->derivation
>              "check-deb-pack"
>              (with-imported-modules '((guix build utils))
>                #~(begin
>                    (use-modules (guix build utils)
>                                 (ice-9 match)
>                                 (ice-9 popen)
>                                 (ice-9 rdelim)
>                                 (ice-9 textual-ports)
>                                 (rnrs base))

Thanks for the feedback.  I wonder if some are of the opinion that since
gexp->derivation is a plain function rather than a syntax having a
special form for its 2nd argument, we should leave the default
indentation rules untouched for it?

My take on this would be a pragmatic one: readable code trumps
indentation rules purity, but I'm interested to gather all the views.

-- 
Thanks,
Maxim



reply via email to

[Prev in Thread] Current Thread [Next in Thread]