unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* GUILE_QUIET=1 guile => suppress REPL welcome message
@ 2024-01-09 13:43 Dr. Arne Babenhauserheide
  2024-01-09 15:50 ` GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format) Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-01-09 13:43 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 3577 bytes --]

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain

Hello,

the following patch makes Guile suppress the repl-welcome message when
the GUILE_QUIET environment variable is set.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline;
 filename=0001-GUILE_QUIET-suppress-repl-welcome-when-GUILE_QUIET-e.patch
Content-Transfer-Encoding: quoted-printable

From=205af642cb967942c7cb46b773431a44ceae1e7cbe Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Tue, 9 Jan 2024 14:40:30 +0100
Subject: [PATCH] GUILE_QUIET: suppress repl-welcome when GUILE_QUIET env is
 set

* module/system/repl/repl.scm (run-repl*): print welcome *unless* GUILE_QUI=
ET is set
* doc/ref/guile-invoke.texi (Environment Variables): document GUILE_QUIET
=2D--
 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 856bce7b8..2e41d3afb 100644
=2D-- a/doc/ref/guile-invoke.texi
+++ b/doc/ref/guile-invoke.texi
@@ -424,6 +424,11 @@ Guile uses the environment variable @env{HOME}, the na=
me of your home
 directory, to locate various files, such as @file{.guile} or
 @file{.guile_history}.
=20
+@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 d83d28759..0fb71ca1c 100644
=2D-- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -159,7 +159,8 @@
   (% (with-fluids ((*repl-stack*
                     (cons repl (or (fluid-ref *repl-stack*) '()))))
        (if (null? (cdr (fluid-ref *repl-stack*)))
=2D           (repl-welcome repl))
+           (unless (getenv "GUILE_QUIET")
+             (repl-welcome repl)))
        (let prompt-loop ()
          (let ((exp (prompting-meta-read repl)))
            (cond
=2D-=20
2.41.0


--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Best wishes,
Arne
=2D-=20
Unpolitisch sein
hei=C3=9Ft politisch sein,
ohne es zu merken.
draketo.de

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJEBAEBCAAuFiEE801qEjXQSQPNItXAE++NRSQDw+sFAmWdTiYQHGFybmVfYmFi
QHdlYi5kZQAKCRAT741FJAPD60UZEACrpKiLdZPEptMl9x36l36HRnXDJrJrO/F7
MeF+4x068pguL21qrsweNCpQjJLPI+Y4fgfENHfZMty+aYd2cO0leKpq6zkkBUta
su9gfsVXBUIKDhM1Uw79wCXT86UnrRWbWvtkHy/6gHh8QGNSBp8AtSf8QCYMNCDb
FUmcHdJ9wSIlP9gcM8+d87FcAHstvoJ/Th4dNcDGB/35G/Es9l4S78n+3D51WUXB
fRlr9utvOtsO77i9YQMcFiexVPkh6Am6MMdGDmcsJMg4jCYe9fKrbiKQfPeNgf9u
ZOdqrIqbjFvuQ/dRz4tcV+KqgG/+IV82sWdoYZeTVEDKqKkp/UPLreCjqVnqzNPf
71hTf6jO7sWn8JTCHQhZ5myPScGpcWx2/zg1J7DTC1yKNh1NhCljJWM7H4A0X6VG
iG0r3IIiu/XYjX3ezjXmTT05v3GAD+cpV+Z563Oycrb6c9qalzyTssJTFsQJLPWK
4X3MXjiHktDUaI8SKkWUtu1GpvaxKwSMxWC8kVKJhRh/D0Bk9rounkfIOlkS54ll
eIiIQCsd1FchiI/YunC/JebbrNROyIpaBSvRX0YSzsPXCNZfw7pOR4x1uicpb1pW
cBZhpmJTDLfL/vEDoqXhEm6UVVxJZqhWTxhgkuZDhXP58t43hmNiNPK1WjQE1if6
BBkUjvmhyojEBAEBCAAuFiEE3Si95tmHXKvOSosd3M8NswvBBUgFAmWdTiYQHGFy
bmVfYmFiQHdlYi5kZQAKCRDczw2zC8EFSJWGA/4k6a5j5fL6Llf5/pU4hglzvZn4
uZhARZpEO0G8VknicwXXu0hhnikpjdZb34j2gD9BnWctrCU5FLFnnxWooPHT/ND4
wbhxHrXMuBXTbkSPkFDXm8nuWMJMce/w1SSQgmW5zLiOx22mrT4q00XlvaQMKoG2
XdvzcrxsTdUqufIGWw==
=CbA+
-----END PGP SIGNATURE-----
--==-=-=--

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-01-09 13:43 GUILE_QUIET=1 guile => suppress REPL welcome message Dr. Arne Babenhauserheide
@ 2024-01-09 15:50 ` Dr. Arne Babenhauserheide
  2024-03-11  1:01   ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-01-09 15:50 UTC (permalink / raw)
  To: guile-devel; +Cc: Dr. Arne Babenhauserheide

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

Sorry for the broken message. Re-sending in mu4e produced strange artifacts.

Here’s a  clean version:
------
Hello,

the following patch makes Guile suppress the repl-welcome message when
the GUILE_QUIET environment variable is set.

From 5af642cb967942c7cb46b773431a44ceae1e7cbe Mon Sep 17 00:00:00 2001
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Tue, 9 Jan 2024 14:40:30 +0100
Subject: [PATCH] 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 856bce7b8..2e41d3afb 100644
--- a/doc/ref/guile-invoke.texi
+++ b/doc/ref/guile-invoke.texi
@@ -424,6 +424,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 d83d28759..0fb71ca1c 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -159,7 +159,8 @@
   (% (with-fluids ((*repl-stack*
                     (cons repl (or (fluid-ref *repl-stack*) '()))))
        (if (null? (cdr (fluid-ref *repl-stack*)))
-           (repl-welcome repl))
+           (unless (getenv "GUILE_QUIET")
+             (repl-welcome repl)))
        (let prompt-loop ()
          (let ((exp (prompting-meta-read repl)))
            (cond
-- 
2.41.0


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-01-09 15:50 ` GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format) Dr. Arne Babenhauserheide
@ 2024-03-11  1:01   ` Dr. Arne Babenhauserheide
  2024-03-11 13:50     ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-03-11  1:01 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]

Hi,

It’s been two months now, did anyone get to review this patch?

It’s small and it gives an instant improvement when using Guile in Emacs
orgmode babel sourceblocks that get evaluated on export.

Best wishes,
Arne

"Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:
> Hello,
>
> the following patch makes Guile suppress the repl-welcome message when
> the GUILE_QUIET environment variable is set.
>
> From 5af642cb967942c7cb46b773431a44ceae1e7cbe Mon Sep 17 00:00:00 2001
> From: Arne Babenhauserheide <arne_bab@web.de>
> Date: Tue, 9 Jan 2024 14:40:30 +0100
> Subject: [PATCH] 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 856bce7b8..2e41d3afb 100644
> --- a/doc/ref/guile-invoke.texi
> +++ b/doc/ref/guile-invoke.texi
> @@ -424,6 +424,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 d83d28759..0fb71ca1c 100644
> --- a/module/system/repl/repl.scm
> +++ b/module/system/repl/repl.scm
> @@ -159,7 +159,8 @@
>    (% (with-fluids ((*repl-stack*
>                      (cons repl (or (fluid-ref *repl-stack*) '()))))
>         (if (null? (cdr (fluid-ref *repl-stack*)))
> -           (repl-welcome repl))
> +           (unless (getenv "GUILE_QUIET")
> +             (repl-welcome repl)))
>         (let prompt-loop ()
>           (let ((exp (prompting-meta-read repl)))
>             (cond
> -- 
> 2.41.0
>
>
> Best wishes,
> Arne


-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-03-11  1:01   ` Dr. Arne Babenhauserheide
@ 2024-03-11 13:50     ` Matt Wette
  2024-03-11 19:41       ` Dr. Arne Babenhauserheide
  2024-05-03 19:38       ` Matt Wette
  0 siblings, 2 replies; 14+ messages in thread
From: Matt Wette @ 2024-03-11 13:50 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

On 3/10/24 6:01 PM, Dr. Arne Babenhauserheide wrote:
> Hi,
>
> It’s been two months now, did anyone get to review this patch?
>
> It’s small and it gives an instant improvement when using Guile in Emacs
> orgmode babel sourceblocks that get evaluated on export.
>
> Best wishes,
> Arne
>
I did look at it.  Another solution, I prefer, is generate a global 
urrent-info-port object and
provide a command-line option to make that a file or /dev/null. Send the 
welcome and
auto-compile messages to (current-info-port).

I had a patch for this at one time, but can't find it right now.

Matt

[-- Attachment #2: Type: text/html, Size: 931 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-03-11 13:50     ` Matt Wette
@ 2024-03-11 19:41       ` Dr. Arne Babenhauserheide
  2024-05-03 19:38       ` Matt Wette
  1 sibling, 0 replies; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-03-11 19:41 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hi Matt,

Matt Wette <matt.wette@gmail.com> writes:
> On 3/10/24 6:01 PM, Dr. Arne Babenhauserheide wrote:
> It’s small and it gives an instant improvement when using Guile in Emacs
> orgmode babel sourceblocks that get evaluated on export.
>
> I did look at it.  Another solution, I prefer, is generate a global urrent-info-port object and
> provide a command-line option to make that a file or /dev/null.   Send the welcome and 
> auto-compile messages to (current-info-port).

I don’t mind the internal implementation. So I chose the option with the
lowest impact on other parts of Guile.

However I chose to use an environment variable because it makes it
easier to adjust the behavior for special situations without bloating
the interface used by most people.

> I had a patch for this at one time, but can't find it right now.

I’ll gladly review it if you find it again. For such small changes I can
also push.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-03-11 13:50     ` Matt Wette
  2024-03-11 19:41       ` Dr. Arne Babenhauserheide
@ 2024-05-03 19:38       ` Matt Wette
  2024-10-02 13:48         ` Dr. Arne Babenhauserheide
  1 sibling, 1 reply; 14+ messages in thread
From: Matt Wette @ 2024-05-03 19:38 UTC (permalink / raw)
  To: guile-devel

On 3/11/24 6:50 AM, Matt Wette wrote:
> On 3/10/24 6:01 PM, Dr. Arne Babenhauserheide wrote:
>> Hi,
>>
>> It’s been two months now, did anyone get to review this patch?
>>
>> It’s small and it gives an instant improvement when using Guile in Emacs
>> orgmode babel sourceblocks that get evaluated on export.
>>
>> Best wishes,
>> Arne
>>
> I did look at it.  Another solution, I prefer, is generate a global 
> urrent-info-port object and
> provide a command-line option to make that a file or /dev/null. Send 
> the welcome and
> auto-compile messages to (current-info-port).
>
> I had a patch for this at one time, but can't find it right now.

I found it.  Here is a link: 
https://github.com/mwette/guile-contrib/blob/main/patch/3.0.9/info-port.patch

If you type `guile -I` you get desired behavior.    Thinking of changing 
to make the info-port /dev/null by default.

Matt




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-05-03 19:38       ` Matt Wette
@ 2024-10-02 13:48         ` Dr. Arne Babenhauserheide
  2024-10-02 15:48           ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-10-02 13:48 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

Matt Wette <matt.wette@gmail.com> writes:

> On 3/11/24 6:50 AM, Matt Wette wrote:
>> On 3/10/24 6:01 PM, Dr. Arne Babenhauserheide wrote:
>>> Hi,
>>>
>>> It’s been two months now, did anyone get to review this patch?
>>>
>>> It’s small and it gives an instant improvement when using Guile in Emacs
>>> orgmode babel sourceblocks that get evaluated on export.
>>>
>>> Best wishes,
>>> Arne
>>>
>> I did look at it.  Another solution, I prefer, is generate a global
>> urrent-info-port object and
>> provide a command-line option to make that a file or /dev/null. Send
>> the welcome and
>> auto-compile messages to (current-info-port).
>>
>> I had a patch for this at one time, but can't find it right now.
>
> I found it.  Here is a link:
> https://github.com/mwette/guile-contrib/blob/main/patch/3.0.9/info-port.patch

The patch looks almost good to go to me.

But this looks wrong:


@@ -524,7 +524,7 @@ scm_set_current_input_port (SCM port)
 
 SCM
 scm_set_current_output_port (SCM port)
-#define FUNC_NAME "scm-set-current-output-port"
+#define FUNC_NAME "set-current-output-port"
 {
   SCM ooutp = scm_fluid_ref (cur_outport_fluid);
   port = SCM_COERCE_OUTPORT (port);

There’s also whitespace changes mixed in.


modified   module/ice-9/boot-9.scm
@@ -190,6 +190,13 @@ This is handy for tracing function calls, e.g.:
   (newline (current-warning-port))
   (car (last-pair stuff)))
 
+(define (info . stuff)
+  (newline (current-info-port))
+  (display ";;; FYI " (current-info-port))
+  (display stuff (current-info-port))
+  (newline (current-info-port))
+  (car (last-pair stuff)))
+


The canonical prefix is INFO, I think. So maybe

+  (display ";;; INFO " (current-info-port))

?

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-02 13:48         ` Dr. Arne Babenhauserheide
@ 2024-10-02 15:48           ` Matt Wette
  2024-10-02 16:25             ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 14+ messages in thread
From: Matt Wette @ 2024-10-02 15:48 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-devel

On 10/2/24 6:48 AM, Dr. Arne Babenhauserheide wrote:
> Matt Wette <matt.wette@gmail.com> writes:
>
>> On 3/11/24 6:50 AM, Matt Wette wrote:
>>> On 3/10/24 6:01 PM, Dr. Arne Babenhauserheide wrote:
>>>> Hi,
>>>>
>>>> It’s been two months now, did anyone get to review this patch?
>>>>
>>>> It’s small and it gives an instant improvement when using Guile in Emacs
>>>> orgmode babel sourceblocks that get evaluated on export.
>>>>
>>>> Best wishes,
>>>> Arne
>>>>
>>> I did look at it.  Another solution, I prefer, is generate a global
>>> urrent-info-port object and
>>> provide a command-line option to make that a file or /dev/null. Send
>>> the welcome and
>>> auto-compile messages to (current-info-port).
>>>
>>> I had a patch for this at one time, but can't find it right now.
>> I found it.  Here is a link:
>> https://github.com/mwette/guile-contrib/blob/main/patch/3.0.9/info-port.patch
> The patch looks almost good to go to me.
>
> But this looks wrong:
>
>
> @@ -524,7 +524,7 @@ scm_set_current_input_port (SCM port)
>   
>   SCM
>   scm_set_current_output_port (SCM port)
> -#define FUNC_NAME "scm-set-current-output-port"
> +#define FUNC_NAME "set-current-output-port"
>   {
>     SCM ooutp = scm_fluid_ref (cur_outport_fluid);
>     port = SCM_COERCE_OUTPORT (port);
If you compare to the input-port and error-port analogs you may come to 
the conclusion I did.
Also, I think some of this code is no longer used.   There may be 
opportunity to remove some.

> There’s also whitespace changes mixed in.

I apologize for that.  I had  (add-to-list 'write-file-functions 
'delete-trailing-whitespace)
in my emacs init file.  I have since removed this feature to remove 
trailing whitespace.

>
> modified   module/ice-9/boot-9.scm
> @@ -190,6 +190,13 @@ This is handy for tracing function calls, e.g.:
>     (newline (current-warning-port))
>     (car (last-pair stuff)))
>   
> +(define (info . stuff)
> +  (newline (current-info-port))
> +  (display ";;; FYI " (current-info-port))
> +  (display stuff (current-info-port))
> +  (newline (current-info-port))
> +  (car (last-pair stuff)))
> +
>
>
> The canonical prefix is INFO, I think. So maybe
>
> +  (display ";;; INFO " (current-info-port))
>
> ?
These sound fine to me.   Thanks for the consideration.

Matt




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-02 15:48           ` Matt Wette
@ 2024-10-02 16:25             ` Dr. Arne Babenhauserheide
  2024-10-02 19:13               ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-10-02 16:25 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-devel


[-- Attachment #1.1: Type: text/plain, Size: 937 bytes --]

Matt Wette <matt.wette@gmail.com> writes:

> On 10/2/24 6:48 AM, Dr. Arne Babenhauserheide wrote:
>>> https://github.com/mwette/guile-contrib/blob/main/patch/3.0.9/info-port.patch
> If you compare to the input-port and error-port analogs you may come
> to the conclusion I did.

Ah, I see — thank you!

> Also, I think some of this code is no longer used.   There may be
> opportunity to remove some.

>> There’s also whitespace changes mixed in.
>
> I apologize for that.  I had  (add-to-list 'write-file-functions
> 'delete-trailing-whitespace)
> in my emacs init file.  I have since removed this feature to remove
> trailing whitespace.

No problem — I left these out when committing.

>> The canonical prefix is INFO, I think. So maybe
>>
>> +  (display ";;; INFO " (current-info-port))
> These sound fine to me.   Thanks for the consideration.

Do these two patches match what you planned?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-Fix-make-output-port-names-consistent-set-current-TY.patch --]
[-- Type: text/x-patch, Size: 842 bytes --]

From 087884f6e965a9ba6d1c05875dfcb0f3820c6441 Mon Sep 17 00:00:00 2001
From: Matt Wette <matt.wette@gmail.com>
Date: Wed, 2 Oct 2024 18:15:48 +0200
Subject: [PATCH 2/2] Fix: make output port names consistent
 set-current-TYPE-port

* libguile/ports.c (scm_set_current_output_port): remove scm-prefix of name
---
 libguile/ports.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 13724edb2..764fa9376 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -524,7 +524,7 @@ scm_set_current_input_port (SCM port)
 
 SCM
 scm_set_current_output_port (SCM port)
-#define FUNC_NAME "scm-set-current-output-port"
+#define FUNC_NAME "set-current-output-port"
 {
   SCM ooutp = scm_fluid_ref (cur_outport_fluid);
   port = SCM_COERCE_OUTPORT (port);
-- 
2.46.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0001-Patch-for-directing-information-messages-e.g.-auto-c.patch --]
[-- Type: text/x-patch, Size: 15234 bytes --]

From ab24e10c2fdd1284e046739eb48190983839322e Mon Sep 17 00:00:00 2001
From: Matt Wette <matt.wette@gmail.com>
Date: Wed, 2 Oct 2024 15:48:09 +0200
Subject: [PATCH 1/2] Patch for directing information messages (e.g.
 auto-compile) to /dev/null

* libguile/init.c (scm_set_current_info_port): new proc
* libguile/load.c (compiled_is_fresh, load_thunk_from_path,
  do_try_auto_compile, scm_sys_warn_auto_compilation_enabled,
  scm_primitive_load_path): use info port for compilation messages
* libguile/ports.c (cur_infoport_fluid): new variable
* libguile/ports.c (scm_current_info_port, scm_set_current_info_port): new proc
* libguile/ports.c (scm_init_ice_9_ports): define %current-info-port-fluid
* libguile/ports.c (scm_init_ports): init cur_infoport_fluid
* libguile/ports.h (scm_current_input_port): declare scm_current_info_port, scm_set_current_info_port
* module/ice-9/boot-9.scm (info): define proc
* module/ice-9/boot-9.scm (load-in-vicinity): use info port
* module/ice-9/command-line.scm (*usage*): document -I
* module/ice-9/command-line.scm (compile-shell-switches): parse -I
* module/ice-9/ports.scm (replace-bootstrap-bindings): provide current-info-port
* module/ice-9/ports.scm (set-current-info-portf, current-info-port): new proc
* module/system/repl/common.scm (make-repl): use info port
---
 libguile/init.c               |  1 +
 libguile/load.c               | 42 +++++++++++++++++------------------
 libguile/ports.c              | 31 ++++++++++++++++++++++++++
 libguile/ports.h              |  2 ++
 module/ice-9/boot-9.scm       | 13 ++++++++---
 module/ice-9/command-line.scm |  7 +++++-
 module/ice-9/ports.scm        | 18 ++++++++++++---
 module/system/repl/common.scm |  8 +++----
 8 files changed, 90 insertions(+), 32 deletions(-)

diff --git a/libguile/init.c b/libguile/init.c
index 4a3903a2c..3df8c5ae5 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -200,6 +200,7 @@ scm_init_standard_ports ()
   scm_set_current_error_port
     (scm_standard_stream_to_port (2, isatty (2) ? "w0" : "w"));
   scm_set_current_warning_port (scm_current_error_port ());
+  scm_set_current_info_port (scm_current_error_port ());
 }


diff --git a/libguile/load.c b/libguile/load.c
index 34e7934b9..35613077b 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -571,11 +571,11 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename,
   else
     {
       compiled_is_newer = 0;
-      scm_puts (";;; note: source file ", scm_current_warning_port ());
-      scm_display (full_filename, scm_current_warning_port ());
-      scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
-      scm_display (compiled_filename, scm_current_warning_port ());
-      scm_puts ("\n", scm_current_warning_port ());
+      scm_puts (";;; note: source file ", scm_current_info_port ());
+      scm_display (full_filename, scm_current_info_port ());
+      scm_puts ("\n;;;       newer than compiled ", scm_current_info_port ());
+      scm_display (compiled_filename, scm_current_info_port ());
+      scm_puts ("\n", scm_current_info_port ());
     }

   return compiled_is_newer;
@@ -770,9 +770,9 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
               if (found_stale_file && *found_stale_file)
                 {
                   scm_puts (";;; found fresh compiled file at ",
-                                     scm_current_warning_port ());
-                  scm_display (found, scm_current_warning_port ());
-                  scm_newline (scm_current_warning_port ());
+                                     scm_current_info_port ());
+                  scm_display (found, scm_current_info_port ());
+                  scm_newline (scm_current_info_port ());
                 }

 	      goto end;
@@ -1017,9 +1017,9 @@ do_try_auto_compile (void *data)
   SCM source = SCM_PACK_POINTER (data);
   SCM comp_mod, compile_file;

-  scm_puts (";;; compiling ", scm_current_warning_port ());
-  scm_display (source, scm_current_warning_port ());
-  scm_newline (scm_current_warning_port ());
+  scm_puts (";;; compiling ", scm_current_info_port ());
+  scm_display (source, scm_current_info_port ());
+  scm_newline (scm_current_info_port ());

   comp_mod = scm_c_resolve_module ("system base compile");
   compile_file = scm_module_variable (comp_mod, sym_compile_file);
@@ -1046,17 +1046,17 @@ do_try_auto_compile (void *data)
       /* Assume `*current-warning-prefix*' has an appropriate value.  */
       res = scm_call_n (scm_variable_ref (compile_file), args, 5);

-      scm_puts (";;; compiled ", scm_current_warning_port ());
-      scm_display (res, scm_current_warning_port ());
-      scm_newline (scm_current_warning_port ());
+      scm_puts (";;; compiled ", scm_current_info_port ());
+      scm_display (res, scm_current_info_port ());
+      scm_newline (scm_current_info_port ());
       return res;
     }
   else
     {
-      scm_puts (";;; it seems ", scm_current_warning_port ());
-      scm_display (source, scm_current_warning_port ());
+      scm_puts (";;; it seems ", scm_current_info_port ());
+      scm_display (source, scm_current_info_port ());
       scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
-                scm_current_warning_port ());
+                scm_current_info_port ());
       return SCM_BOOL_F;
     }
 }
@@ -1099,7 +1099,7 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl
     {
       scm_puts (";;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0\n"
                 ";;;       or pass the --no-auto-compile argument to disable.\n",
-                scm_current_warning_port ());
+                scm_current_info_port ());
       message_shown = 1;
     }

@@ -1232,9 +1232,9 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
           if (found_stale_compiled_file)
             {
               scm_puts (";;; found fresh local cache at ",
-                                 scm_current_warning_port ());
-              scm_display (fallback, scm_current_warning_port ());
-              scm_newline (scm_current_warning_port ());
+                                 scm_current_info_port ());
+              scm_display (fallback, scm_current_info_port ());
+              scm_newline (scm_current_info_port ());
             }
           compiled_thunk = try_load_thunk_from_file (fallback);
         }
diff --git a/libguile/ports.c b/libguile/ports.c
index d0e4e0c7f..13724edb2 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -432,6 +432,7 @@ static SCM cur_inport_fluid = SCM_BOOL_F;
 static SCM cur_outport_fluid = SCM_BOOL_F;
 static SCM cur_errport_fluid = SCM_BOOL_F;
 static SCM cur_warnport_fluid = SCM_BOOL_F;
+static SCM cur_infoport_fluid = SCM_BOOL_F;
 static SCM cur_loadport_fluid = SCM_BOOL_F;

 SCM_DEFINE (scm_current_input_port, "current-input-port", 0, 0, 0,
@@ -488,6 +489,18 @@ SCM_DEFINE (scm_current_warning_port, "current-warning-port", 0, 0, 0,
 }
 #undef FUNC_NAME

+SCM_DEFINE (scm_current_info_port, "current-info-port", 0, 0, 0,
+            (void),
+	    "Return the port to which diagnostic information should be sent.")
+#define FUNC_NAME s_scm_current_info_port
+{
+  if (scm_is_true (cur_infoport_fluid))
+    return scm_fluid_ref (cur_infoport_fluid);
+  else
+    return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0,
 	    (),
 	    "Return the current-load-port.\n"
@@ -545,6 +558,18 @@ scm_set_current_warning_port (SCM port)
 }
 #undef FUNC_NAME

+SCM
+scm_set_current_info_port (SCM port)
+#define FUNC_NAME "set-current-info-port"
+{
+  SCM oinfop = scm_fluid_ref (cur_infoport_fluid);
+  port = SCM_COERCE_OUTPORT (port);
+  SCM_VALIDATE_OPOUTPORT (1, port);
+  scm_fluid_set_x (cur_infoport_fluid, port);
+  return oinfop;
+}
+#undef FUNC_NAME
+
 void
 scm_dynwind_current_input_port (SCM port)
 #define FUNC_NAME NULL
@@ -4187,6 +4212,7 @@ scm_init_ice_9_ports (void)
   scm_c_define ("%current-output-port-fluid", cur_outport_fluid);
   scm_c_define ("%current-error-port-fluid", cur_errport_fluid);
   scm_c_define ("%current-warning-port-fluid", cur_warnport_fluid);
+  scm_c_define ("%current-info-port-fluid", cur_infoport_fluid);
 }

 void
@@ -4221,6 +4247,7 @@ scm_init_ports (void)
   cur_outport_fluid = scm_make_fluid ();
   cur_errport_fluid = scm_make_fluid ();
   cur_warnport_fluid = scm_make_fluid ();
+  cur_infoport_fluid = scm_make_fluid ();
   cur_loadport_fluid = scm_make_fluid ();

   default_port_encoding_var =
@@ -4259,4 +4286,8 @@ scm_init_ports (void)
                       (scm_t_subr) scm_current_error_port);
   scm_c_define_gsubr (s_scm_current_warning_port, 0, 0, 0,
                       (scm_t_subr) scm_current_warning_port);
+
+  /* Used by welcome and compiler routines. */
+  scm_c_define_gsubr (s_scm_current_info_port, 0, 0, 0,
+                      (scm_t_subr) scm_current_info_port);
 }
diff --git a/libguile/ports.h b/libguile/ports.h
index 44ef29d87..d481c2967 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -139,11 +139,13 @@ SCM_API SCM scm_current_input_port (void);
 SCM_API SCM scm_current_output_port (void);
 SCM_API SCM scm_current_error_port (void);
 SCM_API SCM scm_current_warning_port (void);
+SCM_API SCM scm_current_info_port (void);
 SCM_API SCM scm_current_load_port (void);
 SCM_API SCM scm_set_current_input_port (SCM port);
 SCM_API SCM scm_set_current_output_port (SCM port);
 SCM_API SCM scm_set_current_error_port (SCM port);
 SCM_API SCM scm_set_current_warning_port (SCM port);
+SCM_API SCM scm_set_current_info_port (SCM port);
 SCM_API void scm_dynwind_current_input_port (SCM port);
 SCM_API void scm_dynwind_current_output_port (SCM port);
 SCM_API void scm_dynwind_current_error_port (SCM port);
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 627910ad9..04f84215c 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -190,6 +190,13 @@ This is handy for tracing function calls, e.g.:
   (newline (current-warning-port))
   (car (last-pair stuff)))

+(define (info . stuff)
+  (newline (current-info-port))
+  (display ";;; INFO " (current-info-port))
+  (display stuff (current-info-port))
+  (newline (current-info-port))
+  (car (last-pair stuff)))
+
 \f

 ;;; {Features}
@@ -4348,15 +4355,15 @@ when none is available, reading FILE-NAME with READER."
            (load-thunk-from-file go-file-name)
            (begin
              (when gostat
-               (format (current-warning-port)
+               (format (current-info-port)
                        ";;; note: source file ~a\n;;;       newer than compiled ~a\n"
                        name go-file-name))
              (cond
               (%load-should-auto-compile
                (%warn-auto-compilation-enabled)
-               (format (current-warning-port) ";;; compiling ~a\n" name)
+               (format (current-info-port) ";;; compiling ~a\n" name)
                (let ((cfn (compile name)))
-                 (format (current-warning-port) ";;; compiled ~a\n" cfn)
+                 (format (current-info-port) ";;; compiled ~a\n" cfn)
                  (load-thunk-from-file cfn)))
               (else #f)))))
      #:warning "WARNING: compilation of ~a failed:\n" name))
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index 5133d8d44..c1c197f32 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -135,6 +135,7 @@ If FILE begins with `-' the -s switch is mandatory.
                  files.
   --listen[=P]   listen on a local port or a path for REPL clients;
                  if P is not given, the default is local port 37146
+  -I             silence informative diagnostics
   -q             inhibit loading of user init file
   --use-srfi=LS  load SRFI modules for the SRFIs in LS,
                  which is a list of numbers like \"2,13,14\"
@@ -385,7 +386,11 @@ If FILE begins with `-' the -s switch is mandatory.
            ((string=? arg "--listen")   ; start a repl server
             (parse args
                    (cons '((@@ (system repl server) spawn-server)) out)))
-
+
+           ((string=? arg "-I")   ; silence diagostics
+            (parse args
+                   (cons `(current-info-port (%make-void-port "w")) out)))
+
            ((string-prefix? "--listen=" arg) ; start a repl server
             (parse
              args
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 833429eca..e1a6212eb 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -30,10 +30,10 @@
             %port-property
             %set-port-property!
             current-input-port current-output-port
-            current-error-port current-warning-port
+            current-error-port current-warning-port current-info-port
             current-load-port
             set-current-input-port set-current-output-port
-            set-current-error-port
+            set-current-error-port set-current-info-port
             port-mode
             port?
             input-port?
@@ -144,7 +144,8 @@
                               call-with-output-string
                               close-port
                               current-error-port
-                              current-warning-port))
+                              current-warning-port
+                              current-info-port))

 (load-extension (string-append "libguile-" (effective-version))
                 "scm_init_ice_9_ports")
@@ -290,6 +291,13 @@ interpret its input and output."
                         (error "expected an output port" x))
                       x)))

+(define current-info-port
+  (fluid->parameter %current-info-port-fluid
+                    (lambda (x)
+                      (unless (output-port? x)
+                        (error "expected an output port" x))
+                      x)))
+

 \f

@@ -396,6 +404,10 @@ interpret its input and output."
   "Set the current default error port to @var{port}."
   (current-error-port port))

+(define (set-current-info-port port)
+  "Set the current default info port to @var{port}."
+  (current-info-port port))
+

 ;;;; high level routines
 \f
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index a3f2032ba..b7276f319 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -160,10 +160,10 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
               #:debug debug))

 (define (repl-welcome repl)
-  (display *version*)
-  (newline)
-  (newline)
-  (display "Enter `,help' for help.\n"))
+  (display *version* (current-info-port))
+  (newline (current-info-port))
+  (newline (current-info-port))
+  (display "Enter `,help' for help.\n" (current-info-port)))

 (define (repl-prompt repl)
   (cond
--
2.46.0


[-- Attachment #1.4: Type: text/plain, Size: 101 bytes --]


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-02 16:25             ` Dr. Arne Babenhauserheide
@ 2024-10-02 19:13               ` Dr. Arne Babenhauserheide
  2024-10-02 21:56                 ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-10-02 19:13 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

Hi Matt,

I just ran the testsuite after applying your changes, and it stalls at

$ make check -j16
...
;;; SSAX warning: DOCTYPE DECL T system1 found and skipped
UNRESOLVED: time.test: strftime: C99 %z format: strftime fr_FR.iso88591
UNRESOLVED: time.test: strptime: GNU %s format: strftime fr_FR.iso88591

Can you investigate whether this needs changes to tests or causes regressions?

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-02 19:13               ` Dr. Arne Babenhauserheide
@ 2024-10-02 21:56                 ` Matt Wette
  2024-10-04 20:46                   ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Matt Wette @ 2024-10-02 21:56 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

On 10/2/24 12:13 PM, Dr. Arne Babenhauserheide wrote:
> Hi Matt,
>
> I just ran the testsuite after applying your changes, and it stalls at
>
> $ make check -j16
> ...
> ;;; SSAX warning: DOCTYPE DECL T system1 found and skipped
> UNRESOLVED: time.test: strftime: C99 %z format: strftime fr_FR.iso88591
> UNRESOLVED: time.test: strptime: GNU %s format: strftime fr_FR.iso88591
>
> Can you investigate whether this needs changes to tests or causes regressions?
Will do.

[-- Attachment #2: Type: text/html, Size: 790 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-02 21:56                 ` Matt Wette
@ 2024-10-04 20:46                   ` Matt Wette
  2024-10-05 10:23                     ` Dr. Arne Babenhauserheide
  0 siblings, 1 reply; 14+ messages in thread
From: Matt Wette @ 2024-10-04 20:46 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]

On 10/2/24 2:56 PM, Matt Wette wrote:
> On 10/2/24 12:13 PM, Dr. Arne Babenhauserheide wrote:
>> Hi Matt,
>>
>> I just ran the testsuite after applying your changes, and it stalls at
>>
>> $ make check -j16
>> ...
>> ;;; SSAX warning: DOCTYPE DECL T system1 found and skipped
>> UNRESOLVED: time.test: strftime: C99 %z format: strftime fr_FR.iso88591
>> UNRESOLVED: time.test: strptime: GNU %s format: strftime fr_FR.iso88591
>>
>> Can you investigate whether this needs changes to tests or causes regressions?
> Will do.
>

Hi Arne,

I got it working.   I made two changes:
1) I updated the change to ice-9/command-line.scm.  The `patch' command 
rejected the
     location of the `-I' option placement.
2) I reverted the change to system/repl/common.scm which had changed the 
output of the
     welcome message from default output port to info-port.   This was 
causing the repl-server
    test to fail.   If a user uses Guile as a extension, and does not 
want the default Guile welcome
    message, they can generate their own repl.

I hope this is satisfactory.  If not, let me know.

Matt

    something custom

[-- Attachment #2: 0002-system-repl-common.scm-repl-welcome-revert-use-of-in.patch --]
[-- Type: text/x-patch, Size: 982 bytes --]

From 0788066a270a77359ca3aebb97d4ab20039aa071 Mon Sep 17 00:00:00 2001
From: Matthew Wette <mwette@alumni.caltech.edu>
Date: Fri, 4 Oct 2024 13:32:54 -0700
Subject: [PATCH 2/2] system/repl/common.scm(repl-welcome): revert use of
 info-port

---
 module/system/repl/common.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index b7276f319..a3f2032ba 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -160,10 +160,10 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
               #:debug debug))
 
 (define (repl-welcome repl)
-  (display *version* (current-info-port))
-  (newline (current-info-port))
-  (newline (current-info-port))
-  (display "Enter `,help' for help.\n" (current-info-port)))
+  (display *version*)
+  (newline)
+  (newline)
+  (display "Enter `,help' for help.\n"))
 
 (define (repl-prompt repl)
   (cond
-- 
2.43.0


[-- Attachment #3: 0001-close-to-orig-patch.patch --]
[-- Type: text/x-patch, Size: 14035 bytes --]

From 66bc20c90f6e4ae1ad19c969fc234b6038224c4c Mon Sep 17 00:00:00 2001
From: Matthew Wette <mwette@alumni.caltech.edu>
Date: Fri, 4 Oct 2024 07:48:36 -0700
Subject: [PATCH 1/2] close to orig patch

---
 libguile/init.c               |  1 +
 libguile/load.c               | 42 +++++++++++++++++------------------
 libguile/ports.c              | 33 ++++++++++++++++++++++++++-
 libguile/ports.h              |  2 ++
 module/ice-9/boot-9.scm       | 13 ++++++++---
 module/ice-9/command-line.scm |  5 +++++
 module/ice-9/ports.scm        | 18 ++++++++++++---
 module/system/repl/common.scm |  8 +++----
 8 files changed, 90 insertions(+), 32 deletions(-)

diff --git a/libguile/init.c b/libguile/init.c
index 4a3903a2c..3df8c5ae5 100644
--- a/libguile/init.c
+++ b/libguile/init.c
@@ -200,6 +200,7 @@ scm_init_standard_ports ()
   scm_set_current_error_port
     (scm_standard_stream_to_port (2, isatty (2) ? "w0" : "w"));
   scm_set_current_warning_port (scm_current_error_port ());
+  scm_set_current_info_port (scm_current_error_port ());
 }
 
 
diff --git a/libguile/load.c b/libguile/load.c
index 34e7934b9..35613077b 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -571,11 +571,11 @@ compiled_is_fresh (SCM full_filename, SCM compiled_filename,
   else
     {
       compiled_is_newer = 0;
-      scm_puts (";;; note: source file ", scm_current_warning_port ());
-      scm_display (full_filename, scm_current_warning_port ());
-      scm_puts ("\n;;;       newer than compiled ", scm_current_warning_port ());
-      scm_display (compiled_filename, scm_current_warning_port ());
-      scm_puts ("\n", scm_current_warning_port ());
+      scm_puts (";;; note: source file ", scm_current_info_port ());
+      scm_display (full_filename, scm_current_info_port ());
+      scm_puts ("\n;;;       newer than compiled ", scm_current_info_port ());
+      scm_display (compiled_filename, scm_current_info_port ());
+      scm_puts ("\n", scm_current_info_port ());
     }
 
   return compiled_is_newer;
@@ -770,9 +770,9 @@ load_thunk_from_path (SCM filename, SCM source_file_name,
               if (found_stale_file && *found_stale_file)
                 {
                   scm_puts (";;; found fresh compiled file at ",
-                                     scm_current_warning_port ());
-                  scm_display (found, scm_current_warning_port ());
-                  scm_newline (scm_current_warning_port ());
+                                     scm_current_info_port ());
+                  scm_display (found, scm_current_info_port ());
+                  scm_newline (scm_current_info_port ());
                 }
 
 	      goto end;
@@ -1017,9 +1017,9 @@ do_try_auto_compile (void *data)
   SCM source = SCM_PACK_POINTER (data);
   SCM comp_mod, compile_file;
 
-  scm_puts (";;; compiling ", scm_current_warning_port ());
-  scm_display (source, scm_current_warning_port ());
-  scm_newline (scm_current_warning_port ());
+  scm_puts (";;; compiling ", scm_current_info_port ());
+  scm_display (source, scm_current_info_port ());
+  scm_newline (scm_current_info_port ());
 
   comp_mod = scm_c_resolve_module ("system base compile");
   compile_file = scm_module_variable (comp_mod, sym_compile_file);
@@ -1046,17 +1046,17 @@ do_try_auto_compile (void *data)
       /* Assume `*current-warning-prefix*' has an appropriate value.  */
       res = scm_call_n (scm_variable_ref (compile_file), args, 5);
 
-      scm_puts (";;; compiled ", scm_current_warning_port ());
-      scm_display (res, scm_current_warning_port ());
-      scm_newline (scm_current_warning_port ());
+      scm_puts (";;; compiled ", scm_current_info_port ());
+      scm_display (res, scm_current_info_port ());
+      scm_newline (scm_current_info_port ());
       return res;
     }
   else
     {
-      scm_puts (";;; it seems ", scm_current_warning_port ());
-      scm_display (source, scm_current_warning_port ());
+      scm_puts (";;; it seems ", scm_current_info_port ());
+      scm_display (source, scm_current_info_port ());
       scm_puts ("\n;;; is part of the compiler; skipping auto-compilation\n",
-                scm_current_warning_port ());
+                scm_current_info_port ());
       return SCM_BOOL_F;
     }
 }
@@ -1099,7 +1099,7 @@ SCM_DEFINE (scm_sys_warn_auto_compilation_enabled, "%warn-auto-compilation-enabl
     {
       scm_puts (";;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0\n"
                 ";;;       or pass the --no-auto-compile argument to disable.\n",
-                scm_current_warning_port ());
+                scm_current_info_port ());
       message_shown = 1;
     }
 
@@ -1232,9 +1232,9 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1,
           if (found_stale_compiled_file)
             {
               scm_puts (";;; found fresh local cache at ",
-                                 scm_current_warning_port ());
-              scm_display (fallback, scm_current_warning_port ());
-              scm_newline (scm_current_warning_port ());
+                                 scm_current_info_port ());
+              scm_display (fallback, scm_current_info_port ());
+              scm_newline (scm_current_info_port ());
             }
           compiled_thunk = try_load_thunk_from_file (fallback);
         }
diff --git a/libguile/ports.c b/libguile/ports.c
index d0e4e0c7f..764fa9376 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -432,6 +432,7 @@ static SCM cur_inport_fluid = SCM_BOOL_F;
 static SCM cur_outport_fluid = SCM_BOOL_F;
 static SCM cur_errport_fluid = SCM_BOOL_F;
 static SCM cur_warnport_fluid = SCM_BOOL_F;
+static SCM cur_infoport_fluid = SCM_BOOL_F;
 static SCM cur_loadport_fluid = SCM_BOOL_F;
 
 SCM_DEFINE (scm_current_input_port, "current-input-port", 0, 0, 0,
@@ -488,6 +489,18 @@ SCM_DEFINE (scm_current_warning_port, "current-warning-port", 0, 0, 0,
 }
 #undef FUNC_NAME
 
+SCM_DEFINE (scm_current_info_port, "current-info-port", 0, 0, 0,
+            (void),
+	    "Return the port to which diagnostic information should be sent.")
+#define FUNC_NAME s_scm_current_info_port
+{
+  if (scm_is_true (cur_infoport_fluid))
+    return scm_fluid_ref (cur_infoport_fluid);
+  else
+    return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
 SCM_DEFINE (scm_current_load_port, "current-load-port", 0, 0, 0,
 	    (),
 	    "Return the current-load-port.\n"
@@ -511,7 +524,7 @@ scm_set_current_input_port (SCM port)
 
 SCM
 scm_set_current_output_port (SCM port)
-#define FUNC_NAME "scm-set-current-output-port"
+#define FUNC_NAME "set-current-output-port"
 {
   SCM ooutp = scm_fluid_ref (cur_outport_fluid);
   port = SCM_COERCE_OUTPORT (port);
@@ -545,6 +558,18 @@ scm_set_current_warning_port (SCM port)
 }
 #undef FUNC_NAME
 
+SCM
+scm_set_current_info_port (SCM port)
+#define FUNC_NAME "set-current-info-port"
+{
+  SCM oinfop = scm_fluid_ref (cur_infoport_fluid);
+  port = SCM_COERCE_OUTPORT (port);
+  SCM_VALIDATE_OPOUTPORT (1, port);
+  scm_fluid_set_x (cur_infoport_fluid, port);
+  return oinfop;
+}
+#undef FUNC_NAME
+
 void
 scm_dynwind_current_input_port (SCM port)
 #define FUNC_NAME NULL
@@ -4187,6 +4212,7 @@ scm_init_ice_9_ports (void)
   scm_c_define ("%current-output-port-fluid", cur_outport_fluid);
   scm_c_define ("%current-error-port-fluid", cur_errport_fluid);
   scm_c_define ("%current-warning-port-fluid", cur_warnport_fluid);
+  scm_c_define ("%current-info-port-fluid", cur_infoport_fluid);
 }
 
 void
@@ -4221,6 +4247,7 @@ scm_init_ports (void)
   cur_outport_fluid = scm_make_fluid ();
   cur_errport_fluid = scm_make_fluid ();
   cur_warnport_fluid = scm_make_fluid ();
+  cur_infoport_fluid = scm_make_fluid ();
   cur_loadport_fluid = scm_make_fluid ();
 
   default_port_encoding_var =
@@ -4259,4 +4286,8 @@ scm_init_ports (void)
                       (scm_t_subr) scm_current_error_port);
   scm_c_define_gsubr (s_scm_current_warning_port, 0, 0, 0,
                       (scm_t_subr) scm_current_warning_port);
+
+  /* Used by welcome and compiler routines. */
+  scm_c_define_gsubr (s_scm_current_info_port, 0, 0, 0,
+                      (scm_t_subr) scm_current_info_port);
 }
diff --git a/libguile/ports.h b/libguile/ports.h
index 44ef29d87..d481c2967 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -139,11 +139,13 @@ SCM_API SCM scm_current_input_port (void);
 SCM_API SCM scm_current_output_port (void);
 SCM_API SCM scm_current_error_port (void);
 SCM_API SCM scm_current_warning_port (void);
+SCM_API SCM scm_current_info_port (void);
 SCM_API SCM scm_current_load_port (void);
 SCM_API SCM scm_set_current_input_port (SCM port);
 SCM_API SCM scm_set_current_output_port (SCM port);
 SCM_API SCM scm_set_current_error_port (SCM port);
 SCM_API SCM scm_set_current_warning_port (SCM port);
+SCM_API SCM scm_set_current_info_port (SCM port);
 SCM_API void scm_dynwind_current_input_port (SCM port);
 SCM_API void scm_dynwind_current_output_port (SCM port);
 SCM_API void scm_dynwind_current_error_port (SCM port);
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 627910ad9..04f84215c 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -190,6 +190,13 @@ This is handy for tracing function calls, e.g.:
   (newline (current-warning-port))
   (car (last-pair stuff)))
 
+(define (info . stuff)
+  (newline (current-info-port))
+  (display ";;; INFO " (current-info-port))
+  (display stuff (current-info-port))
+  (newline (current-info-port))
+  (car (last-pair stuff)))
+
 \f
 
 ;;; {Features}
@@ -4348,15 +4355,15 @@ when none is available, reading FILE-NAME with READER."
            (load-thunk-from-file go-file-name)
            (begin
              (when gostat
-               (format (current-warning-port)
+               (format (current-info-port)
                        ";;; note: source file ~a\n;;;       newer than compiled ~a\n"
                        name go-file-name))
              (cond
               (%load-should-auto-compile
                (%warn-auto-compilation-enabled)
-               (format (current-warning-port) ";;; compiling ~a\n" name)
+               (format (current-info-port) ";;; compiling ~a\n" name)
                (let ((cfn (compile name)))
-                 (format (current-warning-port) ";;; compiled ~a\n" cfn)
+                 (format (current-info-port) ";;; compiled ~a\n" cfn)
                  (load-thunk-from-file cfn)))
               (else #f)))))
      #:warning "WARNING: compilation of ~a failed:\n" name))
diff --git a/module/ice-9/command-line.scm b/module/ice-9/command-line.scm
index 5133d8d44..1e6149fcc 100644
--- a/module/ice-9/command-line.scm
+++ b/module/ice-9/command-line.scm
@@ -135,6 +135,7 @@ If FILE begins with `-' the -s switch is mandatory.
                  files.
   --listen[=P]   listen on a local port or a path for REPL clients;
                  if P is not given, the default is local port 37146
+  -I             silence informative diagnostics
   -q             inhibit loading of user init file
   --use-srfi=LS  load SRFI modules for the SRFIs in LS,
                  which is a list of numbers like \"2,13,14\"
@@ -382,6 +383,10 @@ If FILE begins with `-' the -s switch is mandatory.
             (parse args
                    (cons '(install-r7rs!) out)))
 
+           ((string=? arg "-I")   ; silence diagostics
+            (parse args
+                   (cons `(current-info-port (%make-void-port "w")) out)))
+
            ((string=? arg "--listen")   ; start a repl server
             (parse args
                    (cons '((@@ (system repl server) spawn-server)) out)))
diff --git a/module/ice-9/ports.scm b/module/ice-9/ports.scm
index 833429eca..e1a6212eb 100644
--- a/module/ice-9/ports.scm
+++ b/module/ice-9/ports.scm
@@ -30,10 +30,10 @@
             %port-property
             %set-port-property!
             current-input-port current-output-port
-            current-error-port current-warning-port
+            current-error-port current-warning-port current-info-port
             current-load-port
             set-current-input-port set-current-output-port
-            set-current-error-port
+            set-current-error-port set-current-info-port
             port-mode
             port?
             input-port?
@@ -144,7 +144,8 @@
                               call-with-output-string
                               close-port
                               current-error-port
-                              current-warning-port))
+                              current-warning-port
+                              current-info-port))
 
 (load-extension (string-append "libguile-" (effective-version))
                 "scm_init_ice_9_ports")
@@ -290,6 +291,13 @@ interpret its input and output."
                         (error "expected an output port" x))
                       x)))
 
+(define current-info-port
+  (fluid->parameter %current-info-port-fluid
+                    (lambda (x)
+                      (unless (output-port? x)
+                        (error "expected an output port" x))
+                      x)))
+
 
 \f
 
@@ -396,6 +404,10 @@ interpret its input and output."
   "Set the current default error port to @var{port}."
   (current-error-port port))
 
+(define (set-current-info-port port)
+  "Set the current default info port to @var{port}."
+  (current-info-port port))
+
 
 ;;;; high level routines
 \f
diff --git a/module/system/repl/common.scm b/module/system/repl/common.scm
index a3f2032ba..b7276f319 100644
--- a/module/system/repl/common.scm
+++ b/module/system/repl/common.scm
@@ -160,10 +160,10 @@ See <http://www.gnu.org/licenses/lgpl.html>, for more details.")
               #:debug debug))
 
 (define (repl-welcome repl)
-  (display *version*)
-  (newline)
-  (newline)
-  (display "Enter `,help' for help.\n"))
+  (display *version* (current-info-port))
+  (newline (current-info-port))
+  (newline (current-info-port))
+  (display "Enter `,help' for help.\n" (current-info-port)))
 
 (define (repl-prompt repl)
   (cond
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-04 20:46                   ` Matt Wette
@ 2024-10-05 10:23                     ` Dr. Arne Babenhauserheide
  2024-10-05 14:28                       ` Matt Wette
  0 siblings, 1 reply; 14+ messages in thread
From: Dr. Arne Babenhauserheide @ 2024-10-05 10:23 UTC (permalink / raw)
  To: Matt Wette; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

Hi Matt,

Matt Wette <matt.wette@gmail.com> writes:
> I got it working.   I made two changes:

Nice!

> 1) I updated the change to ice-9/command-line.scm.  The `patch'
> command rejected the location of the `-I' option placement.

> 2) I reverted the change to system/repl/common.scm which had changed
> the output of the welcome message from default output port to
> info-port. This was causing the repl-server test to fail. If a user
> uses Guile as a extension, and does not want the default Guile welcome
> message, they can generate their own repl.

Thank you!

This fixes the compilation messages (a very long standing complaint),
but I think it should also silence the license information message.

Since you’re already defining the info-fluid, you could check for that
similar to the following (but maybe cleaner: just checking for the info
port could byte us later on):

modified   module/system/repl/repl.scm
@@ -159,7 +159,8 @@
   (% (with-fluids ((*repl-stack*
                     (cons repl (or (fluid-ref *repl-stack*) '()))))
        (if (null? (cdr (fluid-ref *repl-stack*)))
-           (repl-welcome repl))
+           (when (file-port? (fluid-ref (parameter-fluid current-output-port)))
+             (repl-welcome repl)))
        (let prompt-loop ()
          (let ((exp (prompting-meta-read repl)))
            (cond


Do you see a cleaner way to do this? If you have one, that would be
great, because it would be the final step to make Guile much more
convenient for scripting (for example it would save me a ton of hacks
☺).


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format)
  2024-10-05 10:23                     ` Dr. Arne Babenhauserheide
@ 2024-10-05 14:28                       ` Matt Wette
  0 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2024-10-05 14:28 UTC (permalink / raw)
  To: Dr. Arne Babenhauserheide; +Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 816 bytes --]

On 10/5/24 3:23 AM, Dr. Arne Babenhauserheide wrote:
> Hi Matt,
>
>
> Nice!
> 2) I reverted the change to system/repl/common.scm which had changed
> the output of the welcome message from default output port to
> info-port. This was causing the repl-server test to fail. If a user
> uses Guile as a extension, and does not want the default Guile welcome
> message, they can generate their own repl.
> Thank you!
>
> This fixes the compilation messages (a very long standing complaint),
> but I think it should also silence the license information message.
>
> Do you see a cleaner way to do this? If you have one, that would be
> great, because it would be the final step to make Guile much more
> convenient for scripting (for example it would save me a ton of hacks
> ☺).
>

I have an idea.  Let me try.

Matt

[-- Attachment #2: Type: text/html, Size: 1366 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-10-05 14:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-09 13:43 GUILE_QUIET=1 guile => suppress REPL welcome message Dr. Arne Babenhauserheide
2024-01-09 15:50 ` GUILE_QUIET=1 guile → suppress REPL welcome message (fixed message format) Dr. Arne Babenhauserheide
2024-03-11  1:01   ` Dr. Arne Babenhauserheide
2024-03-11 13:50     ` Matt Wette
2024-03-11 19:41       ` Dr. Arne Babenhauserheide
2024-05-03 19:38       ` Matt Wette
2024-10-02 13:48         ` Dr. Arne Babenhauserheide
2024-10-02 15:48           ` Matt Wette
2024-10-02 16:25             ` Dr. Arne Babenhauserheide
2024-10-02 19:13               ` Dr. Arne Babenhauserheide
2024-10-02 21:56                 ` Matt Wette
2024-10-04 20:46                   ` Matt Wette
2024-10-05 10:23                     ` Dr. Arne Babenhauserheide
2024-10-05 14:28                       ` Matt Wette

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).