From 68c4eab949fa40d055ace41be84780ef6ebbe643 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Tue, 16 Sep 2025 15:32:07 +0200 Subject: [PATCH] import: utils: Add API to peek procedure bodies. * guix/import/utils.scm (peekable-lambda, peek-body): Add procedures. * .dir-locals.el: Add peekable-lambda indentation. Signed-off-by: Liliana Marie Prikler --- .dir-locals.el | 1 + guix/import/utils.scm | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/.dir-locals.el b/.dir-locals.el index cea37fc9ef8..3f1d292a199 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -119,6 +119,7 @@ (eval . (put 'call-with-port 'scheme-indent-function 1)) (eval . (put 'guard 'scheme-indent-function 1)) (eval . (put 'lambda* 'scheme-indent-function 1)) + (eval . (put 'peekable-lambda 'scheme-indent-function 1)) (eval . (put 'substitute* 'scheme-indent-function 1)) (eval . (put 'match-record 'scheme-indent-function 3)) (eval . (put 'match-record-lambda 'scheme-indent-function 2)) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 303d29bf8a8..ce7671f4e83 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2022 Kyle Meyer ;;; Copyright © 2022 Philip McGrath ;;; Copyright © 2025 Cayetano Santos +;;; Copyright © 2025 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,6 +67,9 @@ url-fetch guix-hash-url + peekable-lambda + peek-body + package-names->package-inputs maybe-inputs maybe-native-inputs @@ -165,6 +169,14 @@ thrown." "Return the hash of FILENAME in nix-base32 format." (bytevector->nix-base32-string (file-sha256 filename))) +(define-syntax-rule (peekable-lambda args this-body) + (lambda args + #((body . this-body)) + this-body)) + +(define (peek-body proc) + (procedure-property proc 'body)) + (define %spdx-license-identifiers ;; https://spdx.org/licenses/ ;; The gfl1.0, nmap, repoze