Subject: [patch] GUILE_QUIET env to silence diagnostic compile messages and welcome message

From: "Dr. Arne Babenhauserheide" <[email-masked]>
Date: Tue, 29 Apr 2025 23:04:38 +0200

Hi,

I’ve been using the GUILE_QUIET change that extends bug 73685¹ for
almost a year now and it helps me a lot with exporting from org-mode, so
I’d really like to see it merged.

> Matt Wette <[email-masked]> writes:
>> users the ability to silence compile and loading messages that occur

The GUILE_QUIET patch now uses your mechanism. It’s just a way to toggle
it with an environment variable (that I can set in a specific Emacs
instance) instead of for the whole user.

Also included is an entry for the NEWS file to mention the -I switch.

From 70e630eafdabc39b55593feff768ec113c9704de Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <[email-masked]>
Date: Sat, 13 Jul 2024 11:37:03 +0200
Subject: [PATCH 1/2] GUILE_QUIET: suppress repl-welcome when GUILE_QUIET env
 is set

* module/system/repl/repl.scm (run-repl*): print welcome *unless* GUILE_QUIET is set
* doc/ref/guile-invoke.texi (Environment Variables): document GUILE_QUIET
---
 doc/ref/guile-invoke.texi   | 5 +++++
 module/system/repl/repl.scm | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/ref/guile-invoke.texi b/doc/ref/guile-invoke.texi
index 7ceef0bb5..7f7662e20 100644
--- a/doc/ref/guile-invoke.texi
+++ b/doc/ref/guile-invoke.texi
@@ -428,6 +428,11 @@ Guile uses the environment variable @env{HOME}, the name of your home
 directory, to locate various files, such as @file{.guile} or
 @file{.guile_history}.
 
+@item GUILE_QUIET
+@vindex GUILE_QUIET
+The Guile REPL usually shows a startup message. When the environment
+variable @env{GUILE_QUIET} is set, this message is suppressed.
+
 @item GUILE_JIT_THRESHOLD
 @vindex GUILE_JIT_THRESHOLD
 Guile has a just-in-time (JIT) code generator that makes running Guile
diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 1c3407159..9215306a3 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -157,7 +157,8 @@
   (% (with-fluids ((*repl-stack*
                     (cons repl (or (fluid-ref *repl-stack*) '()))))
        (if (and (null? (cdr (fluid-ref *repl-stack*)))
-                (not (%inhibit-welcome-message)))
+                (not (%inhibit-welcome-message))
+                (not (getenv "GUILE_QUIET")))
            (repl-welcome repl))
        (let prompt-loop ()
          (let ((exp (prompting-meta-read repl)))
-- 
2.49.0

From d4bab6136f743eef7633f3d336da8d5821e04bcc Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <[email-masked]>
Date: Sat, 12 Oct 2024 14:29:03 +0200
Subject: [PATCH 2/2] note guile -I in the NEWS file

---
 NEWS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/NEWS b/NEWS
index b4a705231..5e2714ef7 100644
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,12 @@ for-delimited-from-port and for-line-in-file. Of these, for-line-in-file
 is helpful in the common situation where you want a procedure applied to
 every line in a file.
 
+** -I commandline flag to silence diagnostic messages
+
+When guile is started with the -I flag, it will not report diagnostic
+messages (e.g., from compiling source files). This sets
+=current-info-port= to a void-port.
+
 ** Improve 'load-foreign-library' handling of DLLs
 
 The non-libltdl load-foreign-library introduced in 3.0.6 does not handle
-- 
2.49.0

Are these two patches OK to merge?

I can push it myself, but I need a review.

Best wishes,
Arne

¹ https://lists.gnu.org/archive/html/guile-devel/2024-10/msg00023.html