Subject: Re: [bug#74979] [PATCH v2 1/4] scripts: style: Refactor order-packages.

From: Ludovic Courtès <[email-masked]>
Date: Sun, 09 Feb 2025 17:11:50 +0100

Hi,

With the warnings added in patch #4, ‘tests/guix-style.log’ reads this:

--8<---------------cut here---------------start------------->8---
guix style: not sorting top-level S-exp.: ((operating-system (host-name komputilo) (locale eo_EO.UTF-8) #<<vertical-space> height: 1> #<<comment> str: ";; User accounts.\n" margin?: #f> (users (cons (user-account (name alice) (comment Bob's sister) (group users) #<<vertical-space> height: 1> #<<comment> str: ";; Groups fit on one line.\n" margin?: #f> (supplementary-groups (quote (wheel audio video)))) %base-user-accounts)) #<<vertical-space> height: 1> #<<com
--8<---------------cut here---------------end--------------->8---

(It goes on on several lines.)

This is below our standards and probably hard to use in practice.  I
think a better solution here would be to report the source code
location:

  (info loc (G_ "ignoring s-expression~%"))

The problem is how to get source location information.

I see two options:

  1. (read-enable 'positions) and hope that ‘read-with-comments’
     preserves or augments source location info from ‘read’ using the
     ‘source-properties’ side table.  Not pretty.

  2. Have ‘read-with-comments’ insert zero-length blanks with source
     location info right before top-level definitions, which would allow
     us to get partial source location info.  Not great either, but
     avoids the memory-hungry side table.

Thoughts?

For now I’ve applied everything except patch #4.

Thanks,
Ludo’.