From a7c8e68dc51144a6d3981b770aca9c4897fc7c0c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Mar 2026 18:46:35 +0100 Subject: records: Let thunked fields refer to their inherited value. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/records.scm (make-syntactic-constructor)[field-index]: New procedure. [wrap-field-value]: Add optional argument ‘parent’. When it is true, bind F to the inherited field value. [field-bindings/inheritance]: New procedure. Use it. * tests/records.scm ("define-record-type* & thunked & no inherited value") ("define-record-type* & thunked & inherited value") ("define-record-type* & thunked & inherited value & this-record"): New tests. * doc/guix.texi (Defining Package Variants): Update ‘modify-inputs’ example to refer to ‘inputs’. (Writing Manifests): Likewise. * doc/guix-cookbook.texi (Package Variants): Likewise for ‘substitute-keyword-arguments’. Fixes: https://issues.guix.gnu.org/50335 Change-Id: If4e18155ce203637ff9e116ee8098f8997bfebe2 --- doc/guix-cookbook.texi | 2 +- doc/guix.texi | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 4b6f0ca22c..83bce66c17 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -5297,7 +5297,7 @@ did above with transformation options. We can add them like so: "Return P with FLAGS as additional 'configure' flags." (package/inherit p (arguments - (substitute-keyword-arguments (package-arguments p) + (substitute-keyword-arguments arguments ((#:configure-flags original-flags #~(list)) #~(append #$original-flags #$flags)))))) diff --git a/doc/guix.texi b/doc/guix.texi index e7bcd174a8..d5f782f35c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8800,14 +8800,15 @@ dependency like so: (define gdb-sans-guile (package (inherit gdb) - (inputs (modify-inputs (package-inputs gdb) + (inputs (modify-inputs inputs (delete "guile"))))) @end lisp -The @code{modify-inputs} form above removes the @code{"guile"} package -from the @code{inputs} field of @code{gdb}. The @code{modify-inputs} -macro is a helper that can prove useful anytime you want to remove, add, -or replace package inputs. +In the body of the @code{inputs} field above, @code{inputs} is bound to +the inherited value. Thus, the @code{modify-inputs} form above removes +the @code{"guile"} package from the @code{inputs} field of @code{gdb}. +The @code{modify-inputs} macro is a helper that can prove useful anytime +you want to remove, add, or replace package inputs. @defmac modify-inputs inputs clauses Modify the given package inputs, as returned by @code{package-inputs} & co., @@ -9131,7 +9132,7 @@ these lines: (define gdb-sans-guile (package (inherit gdb) - (inputs (modify-inputs (package-inputs gdb) + (inputs (modify-inputs inputs (delete "guile"))))) ;; Return a manifest containing that one package plus Git. -- cgit v1.3