[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#50286] [RFC PATCH] Let 'package-location' returns location of surro
From: |
Sarah Morgensen |
Subject: |
[bug#50286] [RFC PATCH] Let 'package-location' returns location of surrounding 'let'. |
Date: |
Tue, 07 Sep 2021 13:15:48 -0700 |
Hi Ludo,
Ludovic Courtès <ludo@gnu.org> writes:
> Example:
>
> scheme@(guile-user)> ,use(gnu packages base)
> scheme@(guile-user)> ,use(gnu packages accessibility)
> scheme@(guile-user)> ,use(guix)
> scheme@(guile-user)> (package-location footswitch)
> $1 = #<<location> file: "gnu/packages/accessibility.scm" line: 257 column: 4>
> scheme@(guile-user)> (package-definition-location footswitch)
> $2 = #<<location> file: "gnu/packages/accessibility.scm" line: 254 column: 0>
> scheme@(guile-user)> (package-location hello)
> $3 = #<<location> file: "gnu/packages/base.scm" line: 79 column: 2>
> scheme@(guile-user)> (package-definition-location hello)
> $4 = #<<location> file: "gnu/packages/base.scm" line: 78 column: 0>
>
> Thoughts?
This is very clever! Thanks for the work on this. I'm not very good
with macros, but it *looks* like it should work quite well for our
use-case of adjusting a surrounding 'let' expression. And it's less
invasive than rewriting 'let'.
However... it doesn't work for unexported packages. It looks there are
about 200 such packages:
--8<---------------cut here---------------start------------->8---
~/guix$ rg -U '\(define [^\(]+\n.*?\(package' gnu/packages --count
--no-filename | awk '{a+=$1} END {print a}'
233
--8<---------------cut here---------------end--------------->8---
And, to play the pessimist:
What do we get out of this that couldn't be done by "go to package
location; read backwards one sexp until we reach a defining form"
(like Emacs' 'beginning-of-defun')?
--
Sarah