unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Attila Lendvai <attila@lendvai.name>
Cc: 55464@debbugs.gnu.org
Subject: bug#55464: (current-filename) is #f when guix pull'ing
Date: Wed, 18 May 2022 11:14:13 +0200	[thread overview]
Message-ID: <87ee0r42ze.fsf@gnu.org> (raw)
In-Reply-To: <625DOHHScuzJjNNfdQOqaLqGWVTmXC-S9PcF2xU3nzsFYG4XYTSEt0NGXDSXnBqVHqYqr6AsEbTysg7y_fxoqeBkbEtCqMZrx9muo3DlvS0=@lendvai.name> (Attila Lendvai's message of "Mon, 16 May 2022 21:04:10 +0000")

Hi,

Attila Lendvai <attila@lendvai.name> skribis:

> the actual context where i'm encountering this is a package definition where i want to load some hashes from a file relative the to the .scm file:
>
> (define-public foo
>   (let ((hashes
>     (with-input-from-file
>         (string-append (dirname (current-filename))
>                        "/foo.hashes")
>       read)))
>     (package ...)))

Not fully answering your question, but if “foo.hashes” contains hashes
for origins and similar, you could make “foo.hashes” contain something
like:

  (list (base32 …) …)

and, in the .scm, write:

  (include "foo.hashes")

The ‘include’ directive includes the file at macro-expansion time,
similar to #include in C.

Back to the original issue, I suppose ‘current-filename’ return #f when
this .scm is first loaded, before it’s compiled.  Anyway, it’s probably
best to load it at macro-expansion time as you suggested.

HTH,
Ludo’.




  parent reply	other threads:[~2022-05-18  9:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 21:04 bug#55464: (current-filename) is #f when guix pull'ing Attila Lendvai
2022-05-17  0:09 ` bug#55464: alternative way Attila Lendvai
2022-05-18  9:14 ` Ludovic Courtès [this message]
2022-05-19 13:32   ` bug#55464: (current-filename) is #f when guix pull'ing Attila Lendvai
2022-05-21 16:39     ` 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=87ee0r42ze.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=55464@debbugs.gnu.org \
    --cc=attila@lendvai.name \
    /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).