unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sarah Morgensen <iskarian@mgsn.dev>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Maxime Devos <maximedevos@telenet.be>, 50286@debbugs.gnu.org
Subject: [bug#50286] [RFC PATCH] Let 'package-location' returns location of surrounding 'let'.
Date: Tue, 07 Sep 2021 13:15:48 -0700	[thread overview]
Message-ID: <86wnnsgn0r.fsf@mgsn.dev> (raw)
In-Reply-To: <875yvc4254.fsf_-_@gnu.org> ("Ludovic Courtès"'s message of "Tue,  07 Sep 2021 21:27:35 +0200 (8 minutes, 50 seconds ago)")

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




  reply	other threads:[~2021-09-07 20:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 21:26 [bug#50286] [RFC PATCH] Let 'package-location' returns location of surrounding 'let' Maxime Devos
2021-09-06 10:07 ` Ludovic Courtès
2021-09-07 19:27   ` Ludovic Courtès
2021-09-07 20:15     ` Sarah Morgensen [this message]
2021-09-08 13:45       ` Ludovic Courtès
2021-09-07 20:30     ` Maxime Devos
2021-09-08 13:38       ` Ludovic Courtès
2021-09-13 10:37         ` bug#50286: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86wnnsgn0r.fsf@mgsn.dev \
    --to=iskarian@mgsn.dev \
    --cc=50286@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).