unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* on indentation
@ 2019-06-14 16:41 Robert Vollmert
  2019-06-14 19:59 ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Vollmert @ 2019-06-14 16:41 UTC (permalink / raw)
  To: guix-devel

Hi,

a couple of questions regarding indenting scheme code.

* I can run etc/indent-code.el by hand from the guix source
repo, but it would be much nicer to have it available as a
regular executable. I tried briefly but failed to package it
— should the package definition fail to the in-tree local file
or download a a tar ball? I guess the trivial build system with
a manual copy and patch-shebang would be the way to go — could
someone point me at an example package that does something
similar?

* Most source files aren’t indented according to etc/indent-code.el,
presumably because guix import uses (ice-9 pretty-print) which does
things differently. How to deal with this?

* Is anyone aware of a different command-line guile/scheme/sexp
code formatter? etc/indent-code.el is a bit slow, and a tool that
reformats stdin to stdout would be useful for calling from other
editors.

Cheers
Robert

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

* Re: on indentation
  2019-06-14 16:41 on indentation Robert Vollmert
@ 2019-06-14 19:59 ` Ricardo Wurmus
  2019-06-15 11:23   ` Robert Vollmert
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2019-06-14 19:59 UTC (permalink / raw)
  To: Robert Vollmert; +Cc: guix-devel


Hi Robert,

> * I can run etc/indent-code.el by hand from the guix source
> repo, but it would be much nicer to have it available as a
> regular executable.

I would not package it.  Isn’t it already usable as an executable?  It
is a regular script after all.

> * Most source files aren’t indented according to etc/indent-code.el,
> presumably because guix import uses (ice-9 pretty-print) which does
> things differently. How to deal with this?

The importers produce expressions that don’t look the way we want them
to look.  Usually we re-indent the code (with etc/indent-code.el or the
equivalent manual invocation in Emacs) before committing.

Some existing code, however, may predate our indentation refinements,
and yet other parts may have been overlooked.  When we touch those
sections anyway we may also adjust the indentation, but making purely
cosmetic commits is discouraged.

> * Is anyone aware of a different command-line guile/scheme/sexp
> code formatter? etc/indent-code.el is a bit slow, and a tool that
> reformats stdin to stdout would be useful for calling from other
> editors.

I don’t think such a tool exists, also because we specify special
indentation rules for certain Guix-specific macros.  Emacs allows us to
do that so etc/indent-code.el uses Emacs.

Perhaps we can speed it up a little?

--
Ricardo

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

* Re: on indentation
  2019-06-14 19:59 ` Ricardo Wurmus
@ 2019-06-15 11:23   ` Robert Vollmert
  2019-06-15 12:15     ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Vollmert @ 2019-06-15 11:23 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[ missed the list cc previously ]

> On 14. Jun 2019, at 21:59, Ricardo Wurmus <rekado@elephly.net> wrote:
>> * I can run etc/indent-code.el by hand from the guix source
>> repo, but it would be much nicer to have it available as a
>> regular executable.
> 
> I would not package it.  Isn’t it already usable as an executable?  It
> is a regular script after all.

Well here it starts with #!/usr/bin/emacs --script. And guix environment guix
doesn’t provide emacs. It felt like the right way around that would be to
package it, but perhaps adding emacs to the environment and change
the shebang to /usr/bin/env emacs would be a good change then?

>> * Most source files aren’t indented according to etc/indent-code.el,
>> presumably because guix import uses (ice-9 pretty-print) which does
>> things differently. How to deal with this?
> 
> The importers produce expressions that don’t look the way we want them
> to look.  Usually we re-indent the code (with etc/indent-code.el or the
> equivalent manual invocation in Emacs) before committing.
> 
> Some existing code, however, may predate our indentation refinements,
> and yet other parts may have been overlooked.  When we touch those
> sections anyway we may also adjust the indentation, but making purely
> cosmetic commits is discouraged.

I’m curious, why is that discouraged? In my experience for this kind of
formatting issue, the best approach is to get it over with once and for all
and enforce the standards from that point.


>> * Is anyone aware of a different command-line guile/scheme/sexp
>> code formatter? etc/indent-code.el is a bit slow, and a tool that
>> reformats stdin to stdout would be useful for calling from other
>> editors.
> 
> I don’t think such a tool exists, also because we specify special
> indentation rules for certain Guix-specific macros.  Emacs allows us to
> do that so etc/indent-code.el uses Emacs.
> 
> Perhaps we can speed it up a little?

That would be great!

Robert

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

* Re: on indentation
  2019-06-15 11:23   ` Robert Vollmert
@ 2019-06-15 12:15     ` Ricardo Wurmus
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Wurmus @ 2019-06-15 12:15 UTC (permalink / raw)
  To: Robert Vollmert; +Cc: guix-devel


Robert Vollmert <rob@vllmrt.net> writes:

> [ missed the list cc previously ]
>
>> On 14. Jun 2019, at 21:59, Ricardo Wurmus <rekado@elephly.net> wrote:
>>> * I can run etc/indent-code.el by hand from the guix source
>>> repo, but it would be much nicer to have it available as a
>>> regular executable.
>> 
>> I would not package it.  Isn’t it already usable as an executable?  It
>> is a regular script after all.
>
> Well here it starts with #!/usr/bin/emacs --script. And guix environment guix
> doesn’t provide emacs. It felt like the right way around that would be to
> package it, but perhaps adding emacs to the environment and change
> the shebang to /usr/bin/env emacs would be a good change then?

The shebang is a placeholder.  When you run the configure script the
placeholder is replaced with whatever “emacs” was detected.

>> Some existing code, however, may predate our indentation refinements,
>> and yet other parts may have been overlooked.  When we touch those
>> sections anyway we may also adjust the indentation, but making purely
>> cosmetic commits is discouraged.
>
> I’m curious, why is that discouraged? In my experience for this kind of
> formatting issue, the best approach is to get it over with once and for all
> and enforce the standards from that point.

It makes for bad git logs and limits the usefulness of “git blame”.

-- 
Ricardo

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

end of thread, other threads:[~2019-06-15 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-14 16:41 on indentation Robert Vollmert
2019-06-14 19:59 ` Ricardo Wurmus
2019-06-15 11:23   ` Robert Vollmert
2019-06-15 12:15     ` Ricardo Wurmus

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

	https://git.savannah.gnu.org/cgit/guix.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).