From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Wette Newsgroups: gmane.lisp.guile.user Subject: Re: Quiet compilation for scripting Date: Fri, 15 Mar 2024 14:09:40 -0700 Message-ID: References: <874jd7nycq.fsf@free-comp-shop.com> <875xxn9vlk.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19546"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Mar 15 22:10:36 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rlEp1-0004q2-GM for guile-user@m.gmane-mx.org; Fri, 15 Mar 2024 22:10:35 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rlEoH-0003Kz-FT; Fri, 15 Mar 2024 17:09:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rlEoF-0003Ki-MU for guile-user@gnu.org; Fri, 15 Mar 2024 17:09:47 -0400 Original-Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rlEoD-00024n-I1 for guile-user@gnu.org; Fri, 15 Mar 2024 17:09:47 -0400 Original-Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1dddad37712so23789285ad.3 for ; Fri, 15 Mar 2024 14:09:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710536983; x=1711141783; darn=gnu.org; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=2tkygOngQlxkxyWLBLUwU4+8Q+94RaMe4Wno1uOgqAw=; b=DqGMmH9ALP3+MLtAtPuI/kZ1/vOnxhb9H5GZt5tVFGedmzTMhBdXuciVlqCw2lyuM4 4S80smABr2j0t2ok3YnOU96L2mBTvnIA8ZoucW3q5KmzWgsIDZtMc8/2J0YoxWL/KDqk v6Ja1inRZnzCcqpH8pAYIEIsRIrqek7jJW26DP256cGnqndmSMFG/YslMYuaWa9p75MB 9CA1bk6DXamGZQnZhNCeIx6gRwFSQ2TpvYwdGxuK/x2+IcNKgUFo6EHJZnDJoWdXa9Rh Kw0P/oBkWwNAUA8+RgGKrCNr102S1l4KzNA3OeeJvsmH618b/KsadVfV9XZsT8a4SCrg jlsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710536983; x=1711141783; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=2tkygOngQlxkxyWLBLUwU4+8Q+94RaMe4Wno1uOgqAw=; b=TtVnGIsmVl83ND3ZKArlrOlQW7pWI3GLNyHnuDoHtPh7NAkj4ooN2BXcrWmfZ5GlwG z4MTTFEYZFxizmL6/WNJkisUsG0IrU34NXdIiwaDoKqrXElFQguYuRfhfpDnOLp35CRE T0bzu+/UQnQATlpgrc0sP3pwFdy0YWaQAh/0IqP5v/tCTqLr1mDa8a7dSfPprWWvBnzZ JyPJ+YnBB1eOGaCKcsosiePhGvDCjaO1OyB8WTEZ/h5ZzRyF099eiOpUzREOKU+MfEod Iuit3k/mLl8h60oi3vE1FAQ9Ho9zh2mya8pXddVQwx9ur6zeQqJc83u2RJ0Q9W+m9nal z83g== X-Gm-Message-State: AOJu0Yx9xu8PWGAqSuh6pnscC2Yi/VsxA64EtIojX3C9PYUvU/qE5LG4 zhRFdBdvRPlcPBHfm8RUhcaI/jDWRcmn9T69aaFTyNflNnhBMxPe6b5c85Nd X-Google-Smtp-Source: AGHT+IEQ8T+SbV06A79IuhVHWowolkFkDP/ZhOTXw78QFcToXDkUk02z/BrXjnGaMXRJs4QJwWb3SA== X-Received: by 2002:a17:902:d2d0:b0:1dd:b315:906d with SMTP id n16-20020a170902d2d000b001ddb315906dmr7736289plc.8.1710536982815; Fri, 15 Mar 2024 14:09:42 -0700 (PDT) Original-Received: from [192.168.2.154] (64-52-138-37.championbroadband.com. [64.52.138.37]) by smtp.gmail.com with ESMTPSA id d2-20020a170903230200b001deffc90392sm436103plh.35.2024.03.15.14.09.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Mar 2024 14:09:42 -0700 (PDT) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=matt.wette@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19480 Archived-At: On 3/15/24 1:52 PM, Matt Wette wrote: > On 3/15/24 1:47 PM, Marc Chantreux wrote: >> On Fri, Mar 15, 2024 at 08:00:09PM +0100, tomas@tuxteam.de wrote: >>>> I think most of Guile user actually want this feature for a long time. >>>> I can understand. >>> I agree. >> so do I. > > As mentioned on another topic (start=up message) I had once hacked > guile to have a > info-port, with initial welcome message and compile messages going to > (current-info-port). > Adding a command arg to set that to a file or /dev/null would fix both > issues. > > Matt > > I think is it. --- libguile/ports.c-orig 2023-05-29 06:18:05.866508234 -0700 +++ libguile/ports.c 2023-05-29 09:00:54.592316332 -0700 @@ -432,6 +432,7 @@ 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 @@ } #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 @@ } #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 @@ -4155,6 +4180,7 @@ 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 @@ -4189,6 +4215,7 @@ 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 = @@ -4227,4 +4254,8 @@ (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); } --- module/ice-9/command-line.scm-orig 2023-05-29 09:45:37.186157673 -0700 +++ module/ice-9/command-line.scm 2023-05-29 10:36:29.730463604 -0700 @@ -135,6 +135,7 @@ 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 + --info-file=PORT set output file for 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\" @@ -142,6 +143,7 @@ R6RS --r7rs change initial Guile environment to better support R7RS + -W don't print welcome message -h, --help display this help and exit -v, --version display version information and exit \\ read arguments from following script lines")) @@ -386,6 +388,14 @@ (parse args (cons '((@@ (system repl server) spawn-server)) out))) + ((string=? arg "--info-file") ; set info port + (parse args + (cons `(set-current-info-port + ',(open-file + (substring arg (string-length "--info-port=")) + "w")) + out))) + ((string-prefix? "--listen=" arg) ; start a repl server (parse args @@ -405,6 +415,12 @@ (error "unknown argument to --listen")))) out))) + #| + ((string=? "-W" arg) + (parse args + (cons '(skip-welcome) out))) + |# + ((or (string=? arg "-h") (string=? arg "--help")) (shell-usage usage-name #f) (exit 0)) --- module/ice-9/boot-9.scm-orig 2023-05-29 10:40:16.405710774 -0700 +++ module/ice-9/boot-9.scm 2023-05-29 09:26:41.743249629 -0700 @@ -190,6 +190,13 @@ (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))) + ;;; {Features} @@ -4328,15 +4335,15 @@ (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))