Subject: [PATCH] guix: ui: Extend error message.

From: Jakob Kirsch <[email-masked]>
Date: Tue, 1 Apr 2025 18:37:41 +0200

The usual error message for when you forgot to import a variable only includes
a suggestion for when you use (use-modules (...)) but not the #:use-module case
that is used with the (define-module) syntax. This patch extends the error
message so you can easily copy and paste it into the module definition.
From aa3897ef3e99ec959ef27363cb7fd53e53301bd7 Mon Sep 17 00:00:00 2001
Message-ID: <aa38[email-masked]>
From: Jakob Kirsch <[email-masked]>
Date: Tue, 1 Apr 2025 18:34:01 +0200
Subject: [PATCH] guix: ui: Extend error message.

The usual error message for when you forgot to import a variable only includes
a suggestion for when you use (use-modules (...)) but not the #:use-module case
that is used with the (define-module) syntax. This patch extends the error
message so you can easily copy and paste it into the module definition.

Change-Id: Ia3c97a8c60294f4b4159987b438bd45412f0a367
---
 guix/ui.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index d462f7133e..615d3e563a 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -366,8 +366,8 @@ (define* (report-unbound-variable-error args #:key frame)
        (#f
         (display-hint (G_ "Did you forget a @code{use-modules} form?")))
        ((? module? module)
-        (display-hint (G_ "Did you forget @code{(use-modules ~a)}?")
-                      (module-name module)))))))
+        (display-hint (G_ "Did you forget @code{(use-modules ~a)} or @code{#:use-module ~a}?")
+                      (module-name module) (module-name module)))))))

 (define (check-module-matches-file module file)
   "Check whether FILE starts with 'define-module MODULE' and print a hint if

base-commit: 61fe7d1749720d4e6f0feb00a8baa8ca1606e1a4
--
2.49.0