From unknown Fri Aug 15 15:59:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71268: [PATCH v5 0/4] Add module depth information to %load-verbosely output Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 30 May 2024 02:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71268 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 71268@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17170362508365 (code B ref -1); Thu, 30 May 2024 02:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 May 2024 02:30:50 +0000 Received: from localhost ([127.0.0.1]:40136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCVZ3-0002Ar-KP for submit@debbugs.gnu.org; Wed, 29 May 2024 22:30:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:47506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sCVZ1-0002Ai-KB for submit@debbugs.gnu.org; Wed, 29 May 2024 22:30:48 -0400 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 1sCVYq-0005RT-Sd for bug-guile@gnu.org; Wed, 29 May 2024 22:30:36 -0400 Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCVYo-0006Wz-S9 for bug-guile@gnu.org; Wed, 29 May 2024 22:30:36 -0400 Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-6ad86f3cc34so2272956d6.1 for ; Wed, 29 May 2024 19:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717036231; x=1717641031; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Xp6Q3K8i3x4/eBaW2hU9abjhnqBFLjTcqXhpQ58JIRw=; b=UdIwz8VCGfTyLbwkiun/3Yvs3ddt1UwV7h/jEYJKRfgsJp+j40S3/2/0X7VNy9Q/Ht AS9XhM1KvOqnXnk1p04ygPQ0cDtKdWZ7gVgIpaX6f9f+dT27FiWayaQ95s+Rhcv9276V OJZDaBMB5YpwBftpwk09oNLqSF3WCiYkjC10VbgEsX13qTxHzvbO0mfr08zw+6sCCVfJ UxTTmSTKLbhHULQlJJYyCUsL/L0mtGylZsuFE/mzadb+kPKEP2KQcfOp2cxr0722Ieph ymsr2KkJaNj673LIsuG4RO2yxjIR4o76rawfx3xGjPNyKS6USixB7GCM2w03mk+aiZcM jCeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717036231; x=1717641031; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xp6Q3K8i3x4/eBaW2hU9abjhnqBFLjTcqXhpQ58JIRw=; b=MOUVUNEdLL96VXBvEVJ9dBvhEQ3a34U9YBQgK++tO9LwBloDXzXv4boKFlDj/fiZLL TywnuQRs0fBo/3axu4JHHheB9h6PVSPYsUPWgCb+mXqX3QyDKC8l1KzWJ7AWcDRNY/JO YlTG4BP3BGLXedYgWLZSUqn5zuN4THQVChuORIQsH9w/IVfyRS49LWPcAOhM8gKq9H+Y b0iDbiZe5aZo4uiY57EaNbX9SvnuAHL0w0qe5pzkzWJw2wzA/TvJS4jt3Zk0BDK+6rT0 SNCdoxydchQDhfkZxL+SUhwCPIJ55wPKXAUiueR6hYIxuhOeX1YiPZIaTjdHy1xE/pGP /nMg== X-Gm-Message-State: AOJu0Yz8GzqB9X8OPsE9BPNU+47PTWdqPX0u2lIYmeqRccbE0BUpoRfw Vx1986fqUS0NtaVFA8zOPk5dJQXB82c3gXI63uOn/Ggq8baVaUEMFU/gRz0j X-Google-Smtp-Source: AGHT+IF8WN2VRZshJZaEpcxHQcil7rzlY8Gv2ka8lWQmjdwCCZVFCABYOV1KL6RaZ3Aaf2FwPk4/jw== X-Received: by 2002:a05:6214:5b0d:b0:6ab:9deb:7a95 with SMTP id 6a1803df08f44-6ae0cd075dcmr10708106d6.60.1717036231262; Wed, 29 May 2024 19:30:31 -0700 (PDT) Received: from localhost.localdomain (dsl-10-133-96.b2b2c.ca. [72.10.133.96]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6ae01ed9967sm5242916d6.72.2024.05.29.19.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 19:30:30 -0700 (PDT) From: Maxim Cournoyer Date: Wed, 29 May 2024 22:30:22 -0400 Message-ID: <20240530023022.21089-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f29; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf29.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, 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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This change was made to support investigating cyclic module dependencies that sometimes happen in GNU Guix and are difficult to comprehend/debug. For more context, see: . Changes in v5: - Introduce the usage of keywords for %load-hooks, breaking backward compatibility at the benefit of future stability and extensibility Changes in v4: - Remove with-output-to-port in %load-announce and adjust doc Changes in v3: - Replace PAD-COUNT with DEPTH in VISUAL-DEPTH guard. Changes in v2: - Guard against negative pad count when computing 'visual-depth' Maxim Cournoyer (4): (ice-9 boot-9): Fix typo. .dir-locals: Set c-basic-offset to 2 for c-mode. guix.scm: Add git:send-email to environment, for convenience. load: Display modules depth in output when using %load-verbosely. .dir-locals.el | 1 + .guix/modules/guile-package.scm | 3 +- NEWS | 13 +++++++ THANKS | 1 + doc/guile-api.alist | 4 +- doc/ref/api-evaluation.texi | 66 ++++++++++++++++++++++++++------- libguile/load.c | 64 +++++++++++++++++++++++++------- libguile/load.h | 4 +- module/ice-9/boot-9.scm | 39 ++++++++++++------- 9 files changed, 149 insertions(+), 46 deletions(-) base-commit: 779a83d9c682345802f9a605cb8e2b4892129316 -- 2.41.0 From unknown Fri Aug 15 15:59:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71268: [PATCH v5 1/4] (ice-9 boot-9): Fix typo. References: <20240530023022.21089-1-maxim.cournoyer@gmail.com> In-Reply-To: <20240530023022.21089-1-maxim.cournoyer@gmail.com> Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Jun 2024 02:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71268 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 71268@debbugs.gnu.org Cc: Maxime Devos , Maxim Cournoyer Received: via spool by 71268-submit@debbugs.gnu.org id=B71268.171720794432666 (code B ref 71268); Sat, 01 Jun 2024 02:13:01 +0000 Received: (at 71268) by debbugs.gnu.org; 1 Jun 2024 02:12:24 +0000 Received: from localhost ([127.0.0.1]:55547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEJ-0008Un-U8 for submit@debbugs.gnu.org; Fri, 31 May 2024 22:12:24 -0400 Received: from mail-qk1-f172.google.com ([209.85.222.172]:49300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEG-0008US-AI for 71268@debbugs.gnu.org; Fri, 31 May 2024 22:12:22 -0400 Received: by mail-qk1-f172.google.com with SMTP id af79cd13be357-794ab13bb88so166944685a.2 for <71268@debbugs.gnu.org>; Fri, 31 May 2024 19:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717207862; x=1717812662; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SFrNMN0cGMM426p6XPje0AL8mbxsUCa8Zm8h/A3X3c4=; b=Gqr6KXRc62GUGoOTrQHS+s50Bd54Nnh5N1DuZgDrm4XBDln5l4WUuu+CER8vTNMxxE zdJf0ZQgETbUxJ//m/lKS2VTNlo+gb9lbPWKVcs8E9y5n4wAKPQzMYXKYlg/i85xwUHK 6m/WZo9/oZSWj2n9d2ubY2PVf0tIGaZSWa5FWKPSpqBlxGkasGdA4hV3RKbpN9H1Koxd YbmAoyMHQ/Y6tSShIRyhOWNifV4cgZGFJGkyfBsAze96KIXHGV4kgsJFGRTdthYs8fhK +JrAFZbZQaaOvCfM6Po+rofUNRlYdkU/OA+BgFCPsOtBw0gPvxaKiTLibXC7Ru3B96tI IDmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717207862; x=1717812662; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SFrNMN0cGMM426p6XPje0AL8mbxsUCa8Zm8h/A3X3c4=; b=N4Hhd/d5JsKpR5uBfc7K1oZdCztc5b8EEPjsGdZLhCgCnjyndLxT3dTltHZb4QMJGs lkL6h2XhMfhIBEbpQ0mggyQGcBfD/TlKFY53CpzlTLlQK0wlku3FSXUQx55gR1rfGgxg p8UQj8Hzhy/LNHJoPpw8iOOgrKstuqBeI4wuD6yJDi35pYLXOBFMcYg97myxAf5wVHPH F9GPUveRZR6FS54hrPITjN3Nw+H0rIjfMOgR35fX+60NYu5qaGkP5szecyQ8F6XPvlB/ +LuHBjzo6YD4qo4VPuFU93eXM6EJBGmB875oLMB1930qJWov7IZmZea1qS7OqDSGeKu1 cykg== X-Gm-Message-State: AOJu0YwLG65WlhJ4LImyGMUv03PlM0bnN/KlFrWDVnkjPODTrxg+/5Ni ereJva15J6ks8Gwc8kJPvtJ+UCIYBReEq5rT2QDtpvxOpgDxDGFaq3IDTQ== X-Google-Smtp-Source: AGHT+IEDcPxA+yBOT2emna7v4fEtM/PbvBg712HSC03q3uxxCKXvvKTp82luw7dRPhnRDL0Vq887bg== X-Received: by 2002:a05:620a:6209:b0:792:9f96:f7a with SMTP id af79cd13be357-794f5ed1162mr359868185a.66.1717207861868; Fri, 31 May 2024 19:11:01 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-92.b2b2c.ca. [205.233.124.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-794f317068dsm101739185a.106.2024.05.31.19.11.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 19:11:01 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 31 May 2024 22:10:08 -0400 Message-ID: <20240601021053.32412-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * module/ice-9/boot-9.scm (module-use-interfaces!): Fix typo in doc string. --- (no changes since v1) module/ice-9/boot-9.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 378ae2457..10423d35e 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2927,7 +2927,7 @@ uses)." (define (module-use-interfaces! module interfaces) "Same as MODULE-USE!, but only notifies module observers after all -interfaces are added to the inports list." +interfaces are added to the imports list." (let* ((cur (module-uses module)) (new (let lp ((in interfaces) (out '())) (if (null? in) -- 2.41.0 From unknown Fri Aug 15 15:59:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71268: [PATCH v5 2/4] .dir-locals: Set c-basic-offset to 2 for c-mode. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Jun 2024 02:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71268 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 71268@debbugs.gnu.org Cc: Maxime Devos , Maxim Cournoyer Received: via spool by 71268-submit@debbugs.gnu.org id=B71268.171720794432673 (code B ref 71268); Sat, 01 Jun 2024 02:13:02 +0000 Received: (at 71268) by debbugs.gnu.org; 1 Jun 2024 02:12:24 +0000 Received: from localhost ([127.0.0.1]:55550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEK-0008Uq-92 for submit@debbugs.gnu.org; Fri, 31 May 2024 22:12:24 -0400 Received: from mail-qk1-f171.google.com ([209.85.222.171]:53264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEI-0008UU-3V for 71268@debbugs.gnu.org; Fri, 31 May 2024 22:12:22 -0400 Received: by mail-qk1-f171.google.com with SMTP id af79cd13be357-794ac6b5409so194408885a.2 for <71268@debbugs.gnu.org>; Fri, 31 May 2024 19:12:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717207864; x=1717812664; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eJpOXRJGXbgxYipxWB0pUQ2S4IPFELI1k+iWAACO8xw=; b=cZwBJq9BCM+RIbzk9KoAjtNhDsNtGRoVJ54IXilI8FQ5/NOifb/sczWeFteSjWlxqU IjpBHX2IPZ9aQfhm12tppLG1Ab7vHVYkRYutbQR2pWmFXJoUhzNocrJ7oFU+qsJxbmjt 484uhNEIc9rGVqujZfjpzwTIb7/CKbq3RQG63PPcesigbHkEwMVqUyLhVyS6Y08Y7buV ZKfzkFSO9rkLYbUuV3iJKT0Xwi1FpQjOYaDtk9hNzhlBOVAu9UDiUcRm4mXUfvvRf1ug BN9mFxULqBrjuznLZsrAlY3lywg8817QCsgH3mmrbXGlraqcOPB6eoF4XKeRlU6t+TAF xYyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717207864; x=1717812664; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eJpOXRJGXbgxYipxWB0pUQ2S4IPFELI1k+iWAACO8xw=; b=Jyp4HDemXm9Fht2VW59sxdBf6XFgB82zJIM5D60wYddn/zffD8MJh0BDp9a3noIQr+ pzyv6i0Ph6SWO7IpMRid0eOO12hd9WM/781XS8+kodIXLZwOJfFP98TMtLo97d9v2wfC GhKOtZdXV+WuZJMEjUsKbxtpJmynM0AdvCQhS1nYnI83igJI5jS1NzjKhboNYT69Q63n vzh4eaBqNzwUfbKJRSIv5+YG/J9OZ3d1WhX9XEM+pOFTvMHyuJMAwXNMfFpcrxTGj7yk zibFmO0DECoJ7uftlz9MTF+f4xYLMKkN1Mzpgud3HFfukkHkMWp0q4iswvW07Vdsndkh wHZA== X-Gm-Message-State: AOJu0YyIabL8bggBkmnEI0mIb4cShIOeJ+KoumMqwmDwAmmxtuVo/phC BXx1OIbCM+FfMalwVbXakdmYS5AwTTuYBtLue3/9ev4qFz7IXNNjCaAV8g== X-Google-Smtp-Source: AGHT+IGr/aujSzfgxMevrkQLvtu1fbYtsuziIWizmN2iOA/QrZgr+LLteOvkCSFQQihom+FyeI3B3g== X-Received: by 2002:a05:620a:f06:b0:792:c30a:ba1 with SMTP id af79cd13be357-794f5cc83bdmr405380685a.57.1717207863915; Fri, 31 May 2024 19:11:03 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-92.b2b2c.ca. [205.233.124.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-794f317068dsm101739185a.106.2024.05.31.19.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 19:11:02 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 31 May 2024 22:10:09 -0400 Message-ID: <20240601021053.32412-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240601021053.32412-2-maxim.cournoyer@gmail.com> References: <20240601021053.32412-2-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * .dir-locals.el (c-mode): Set c-basic-offset to 2. --- (no changes since v1) .dir-locals.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.dir-locals.el b/.dir-locals.el index 908670479..f63bdc8a3 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -3,6 +3,7 @@ ((nil . ((fill-column . 72) (tab-width . 8))) (c-mode . ((c-file-style . "gnu") + (c-basic-offset . 2) (indent-tabs-mode . nil))) (scheme-mode . ((indent-tabs-mode . nil) -- 2.41.0 From unknown Fri Aug 15 15:59:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71268: [PATCH v5 3/4] guix.scm: Add git:send-email to environment, for convenience. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Jun 2024 02:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71268 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 71268@debbugs.gnu.org Cc: Maxime Devos , Maxim Cournoyer Received: via spool by 71268-submit@debbugs.gnu.org id=B71268.171720795432700 (code B ref 71268); Sat, 01 Jun 2024 02:13:02 +0000 Received: (at 71268) by debbugs.gnu.org; 1 Jun 2024 02:12:34 +0000 Received: from localhost ([127.0.0.1]:55553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEET-0008VK-I1 for submit@debbugs.gnu.org; Fri, 31 May 2024 22:12:34 -0400 Received: from mail-qk1-f179.google.com ([209.85.222.179]:57830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEJ-0008UY-VP for 71268@debbugs.gnu.org; Fri, 31 May 2024 22:12:25 -0400 Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-794ab0f7214so125964985a.3 for <71268@debbugs.gnu.org>; Fri, 31 May 2024 19:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717207866; x=1717812666; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=seraSK7Dpgv91/L1CWnIGM0Q9jMlZaO0xYnh91DbPGY=; b=jMh+VQN+2FT75t0bXwDyks1x+q3rooluUYKYu56QbZgPjw1gPrB0kQRCsxqprnbwdY 5oehMA3Ix6g9ru6JUJyr0PltgnGNKusJTHfsVbhqOYTtBCDgBuXCeVu2cqY8i41gqJOb o+2fBli+3h2v8P9CXm4JHOv2iJHdoXVUK0J0PPw/i0FrGlF3K/AyOmkXOEx/P2mB2+4/ 4vsToYUxiJze7ryyWXn7gM7Zi8aioiEJOL9rYCxTWvRTQJhYLEsc6dQ2+h7mKWDu4zb1 OBxhsxsbzEMabzJuSiQohJfYwcRxEciamzwHHr14rBqMIt7dY/HMsNORlbQfNYoqSjtW XwJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717207866; x=1717812666; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=seraSK7Dpgv91/L1CWnIGM0Q9jMlZaO0xYnh91DbPGY=; b=ftGS2zlbEcJ/zyCvUFxrVkmv6aUalgCiZBt5znfxGQezBpxQHbjaR9EnWUmPsffE18 nhFBY+f+qlOMAMn8hbPK8mMPRJ/Z8MuNr8Fgw1hEFVkGxdySbglDO0kT98b/Ir4HIeB0 qB9tPvI8dh95WcrxuqHiPlG6W8Oopvc43Jv8qTCYtYUxwSxMiYThfVoB5yem18DEFzEf 2gXWfcGMZtsnFJBmKMbWnWmt5Z/Rzg9x7cV2ABzSXg5gm707K02fBRX03UBib0yARP1I Iay0NeSb+wvwxac0mdrCLB0i+xc32s1bYgX7KroWRQQrtGjLraethBe/yiOv610gFjx4 4h5g== X-Gm-Message-State: AOJu0Yz8IqMCXOBbi21pz6uN7UYk0hBwo7DcaukGmmteNikFVlFUVj/P DXYN3E71FZIzm2/K4dvT/FoYhTBowSMjxXZijSkJlPgwVR++/7vT/sIqeA== X-Google-Smtp-Source: AGHT+IEWPBW+aWF42clNBAxnkK8qH7NJAYd2//vYenfV+P82WF7BFVSE2R4Rv8wtrfSS6g6GXhFY2g== X-Received: by 2002:a05:620a:4256:b0:794:de79:f5e0 with SMTP id af79cd13be357-794f5c669eemr438591485a.7.1717207865810; Fri, 31 May 2024 19:11:05 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-92.b2b2c.ca. [205.233.124.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-794f317068dsm101739185a.106.2024.05.31.19.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 19:11:04 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 31 May 2024 22:10:10 -0400 Message-ID: <20240601021053.32412-4-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240601021053.32412-2-maxim.cournoyer@gmail.com> References: <20240601021053.32412-2-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * guix.scm (guile) [native-inputs]: Add git:send-email. --- (no changes since v1) .guix/modules/guile-package.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.guix/modules/guile-package.scm b/.guix/modules/guile-package.scm index ad297a010..bca8d3cdf 100644 --- a/.guix/modules/guile-package.scm +++ b/.guix/modules/guile-package.scm @@ -112,10 +112,11 @@ gnu-gettext flex texinfo - texlive-scheme-basic ;for "make pdf" + texlive-scheme-basic ;for "make pdf" texlive-epsf gperf git + `(,git "send-email") ;for convenience gdb strace readline -- 2.41.0 From unknown Fri Aug 15 15:59:30 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71268: [PATCH v5 4/4] load: Display modules depth in output when using %load-verbosely. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Jun 2024 02:13:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71268 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch To: 71268@debbugs.gnu.org Cc: Maxime Devos , Maxim Cournoyer Received: via spool by 71268-submit@debbugs.gnu.org id=B71268.171720795532707 (code B ref 71268); Sat, 01 Jun 2024 02:13:03 +0000 Received: (at 71268) by debbugs.gnu.org; 1 Jun 2024 02:12:35 +0000 Received: from localhost ([127.0.0.1]:55555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEU-0008VN-4x for submit@debbugs.gnu.org; Fri, 31 May 2024 22:12:35 -0400 Received: from mail-qk1-f180.google.com ([209.85.222.180]:42456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sDEEM-0008Ua-PC for 71268@debbugs.gnu.org; Fri, 31 May 2024 22:12:28 -0400 Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-792bdf626beso249540685a.1 for <71268@debbugs.gnu.org>; Fri, 31 May 2024 19:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717207868; x=1717812668; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4xYm6sF4pQgLP4qgVUTXC6GmvWdC9t4YQKXqNkR2o4k=; b=A9drhw0HcdDnwxj/RhZGh53ulr1KYSeVxt4kiWm4X47PFDxjNl/NnBCsU6YIDRfn6v /LPxxBth4sPaT4sFik0esg+tU28lYDJ+Qz37eTRZ9tJS9j2sDMZDykNULjCNnPEi1gr0 BYwqz1El+868CP7fBc96LL6XRhili8qpC9lxdzmRajk8lN9D/WCdsVKxfMpzo/9fTSuU vqcrZteavWfkB6WVHUfRCfUHV8ivV/kKrkYOj2/ms4OSfTcZCHKJbq850XEtz+mAfajO 4fMmWM4PzR+1qg/PEEuDjSfoOnWjS+7/nMsHfxLvDT/7xI6FnPxZJU+QOS4z3i62xn/k 48hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717207868; x=1717812668; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4xYm6sF4pQgLP4qgVUTXC6GmvWdC9t4YQKXqNkR2o4k=; b=gj4GRY/Auz3y300KmpU6KK0hZ5wvofyi75u629F9XNhfnT8Nc8Gqz2ITxL5pqf0hdl ed73LzkCHbR6Uz1G1hzPvOlSDGsjQq3MG6d0E2wckjkNEtcp++E1RVC5AwN0pHdm37OT UyxiFdxlZFGya5cpebKf5o9GaKNEQqUhjcsGoX+V7AF6blW9gfMJE9hBcIA7juhKFA++ S2sjYcf+FmGFzvS84DziJIYcN8vt1DwulsldgQspieObUtVpcc6pbLvzR5WT7BtIPg5q sfdA6txGHW7n8B9l20F9Ay0UVihFvXaZD8y9f+3qSI0H/n4B9JhdC8jogQ6Kcu1pyMdY QpOA== X-Gm-Message-State: AOJu0YzPACqQaVtsc30ZFBkjisP6CBInF1JRuUgoQw2ubUCKuR5bAE5q GEq4stPAAKAy8b2+AT8JvNz9oZ1fwOe+WBv/cpj4RCGOYFWCNsinf7I9SA== X-Google-Smtp-Source: AGHT+IEEmMdYIZ9BjQkJ6bn4z2s79Q3VOcrKSq9CqQYAJtwFt98m8TcP+UtIYLhjpUkcIp3OpslHdQ== X-Received: by 2002:a05:620a:5803:b0:792:9c83:dbc7 with SMTP id af79cd13be357-794f4fd4ae4mr544286585a.31.1717207867804; Fri, 31 May 2024 19:11:07 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-124-92.b2b2c.ca. [205.233.124.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-794f317068dsm101739185a.106.2024.05.31.19.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 19:11:06 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 31 May 2024 22:10:11 -0400 Message-ID: <20240601021053.32412-5-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240601021053.32412-2-maxim.cournoyer@gmail.com> References: <20240601021053.32412-2-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * NEWS: Update news. * THANKS: Add myself. * doc/guile-api.alist (%load-announce, %load-hook): Add DEPTH argument. * doc/ref/api-evaluation.texi (Loading): Document new DEPTH argument for the primitive-load, primitive-load-path and %load-hook procedures. Update %load-hook example. Document %load-verbosely. * libguile/load.c (scm_loc_load_hook): Update doc. (call_hook): New procedure. (scm_primitive_load): Modify to accept a single list of arguments, like for scm_primitive_load_path, so to accept an optional DEPTH argument. Call hook via the 'call_hook' procedure. (scm_primitive_load_path): Accept a third optional DEPTH argument. Call hook via the 'call_hook' procedure. Pass depth to the 'scm_primitive_load' procedure call. * libguile/load.h (scm_primitive_load) (scm_primitive_load_path): Add 'depth' to argument name. * module/ice-9/boot-9.scm (%load-announce): Accept a DEPTH keyword argument, and use it to display the modules loaded hierarchically. Use format instead of display. (%current-module-load-depth): New parameter. (resolve-module): Use it. (try-module-autoload): Call primitive-load-path with it. (load-in-vicinity): Invoke %load-hook with it. Reviewed-by: Maxime Devos --- Changes in v5: - Introduce the usage of keywords for %load-hooks, breaking backward compatibility at the benefit of future stability and extensibility Changes in v4: - Remove with-output-to-port in %load-announce and adjust doc Changes in v3: - Replace PAD-COUNT with DEPTH in VISUAL-DEPTH guard. Changes in v2: - Guard against negative pad count when computing 'visual-depth' NEWS | 13 ++++++++ THANKS | 1 + doc/guile-api.alist | 4 +-- doc/ref/api-evaluation.texi | 66 +++++++++++++++++++++++++++++-------- libguile/load.c | 64 +++++++++++++++++++++++++++-------- libguile/load.h | 4 +-- module/ice-9/boot-9.scm | 37 +++++++++++++-------- 7 files changed, 145 insertions(+), 44 deletions(-) diff --git a/NEWS b/NEWS index c9a713c1e..68a10555a 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,19 @@ files. See "Random Access" in the manual for details. A list of superclasses can now be provided via #:super. +** The %load-hook procedure is now applied with an extra 'depth' argument + +This is a *backward incompatible* change that affects current +user-defined load hooks. New hooks should be defined using a signature +like: + +(define* (my-hook file #:key (depth 0) #:allow-other-keys) ...) + +The newly introduced DEPTH argument is used to show the depth level of +the module being load in the output when setting %load-verbosely to +#t, which makes it easier to inspect which module caused others to be +loaded. + * Bug fixes ** Fix incorrect comparison between exact and inexact numbers diff --git a/THANKS b/THANKS index aa4877e95..546f79b45 100644 --- a/THANKS +++ b/THANKS @@ -5,6 +5,7 @@ Contributors since the last release: Rob Browning Tristan Colgate-McFarlane Aleix Conchillo Flaqué + Maxim Cournoyer Ludovic Courtès Jason Earl Paul Eggert diff --git a/doc/guile-api.alist b/doc/guile-api.alist index a1616149f..20c900166 100644 --- a/doc/guile-api.alist +++ b/doc/guile-api.alist @@ -37,9 +37,9 @@ (%init-rdelim-builtins (groups Scheme) (scan-data "#")) (%init-rw-builtins (groups Scheme) (scan-data "#")) (%library-dir (groups Scheme) (scan-data "#")) -(%load-announce (groups Scheme) (scan-data "#")) +(%load-announce (groups Scheme) (scan-data "#")) (%load-extensions (groups Scheme) (scan-data "")) -(%load-hook (groups Scheme) (scan-data "#")) +(%load-hook (groups Scheme) (scan-data "#")) (%load-path (groups Scheme) (scan-data "")) (%load-verbosely (groups Scheme) (scan-data "")) (%make-void-port (groups Scheme) (scan-data "#")) diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index 68bf38e54..48a811395 100644 --- a/doc/ref/api-evaluation.texi +++ b/doc/ref/api-evaluation.texi @@ -865,14 +865,20 @@ calling @code{load-compiled} on the resulting file is equivalent to calling @code{load} on the source file. @end deffn -@deffn {Scheme Procedure} primitive-load filename +@deffn {Scheme Procedure} primitive-load filename [depth] @deffnx {C Function} scm_primitive_load (filename) Load the file named @var{filename} and evaluate its contents in the top-level environment. @var{filename} must either be a full pathname or be a pathname relative to the current directory. If the variable @code{%load-hook} is defined, it should be bound to a procedure that will be called before any code is loaded. See the documentation for -@code{%load-hook} later in this section. +@code{%load-hook} later in this section. An optional keyword argument, +@var{#:depth}, can be specified to track the depth at which modules are +loaded. + +For compatibility with Guile 3.9 and earlier, the C function takes only +one argument, which can be either a string (the file name) or an +argument list. @end deffn @deftypefn {C Function} SCM scm_c_primitive_load (const char *filename) @@ -905,20 +911,52 @@ change occurs at the right time. @end defvar @defvar %load-hook -A procedure to be called @code{(%load-hook @var{filename})} whenever a -file is loaded, or @code{#f} for no such call. @code{%load-hook} is -used by all of the loading functions (@code{load} and -@code{primitive-load}, and @code{load-from-path} and +A procedure to be called @code{(%load-hook @var{filename} #:depth @var{depth})} +whenever a file is loaded, or @code{#f} for no such call. +@code{%load-hook} is used by all of the loading functions (@code{load} +and @code{primitive-load}, and @code{load-from-path} and @code{primitive-load-path} documented in the next section). -For example an application can set this to show what's loaded, +The default @code{%load-hook} is bound to a procedure that does +something like: @example -(set! %load-hook (lambda (filename) - (format #t "Loading ~a ...\n" filename))) -(load-from-path "foo.scm") -@print{} Loading /usr/local/share/guile/site/foo.scm ... +(define* (%load-hook file #:key (depth 0) #:allow-other-keys) + (when %load-verbosely + (let* ((pad-count (- 3 (string-length (number->string depth)))) + (pad (if (> pad-count 0) + (make-string pad-count #\space) + "")) + (visual-depth (if (> depth 0) + (make-string depth #\space) + ""))) + (format (current-warning-port) + ";;; loading ~a~a ~a~a~%" pad depth visual-depth file) + (force-output (current-warning-port))))) @end example + +It is important to define your @code{%load-hook} with at least the +@code{#:depth} keyword argument as well as the @code{#:allow-other-keys} +modifier, which allows for future backward compatibility of hooks. + +@vindex %load-verbosely, to enable default %load-hook output +As you can see from the above procedure, an application can thus set the +@code{%load-verbosely} variable to @code{#t} to enable the default load +hook output, which produces something like: + +@example +@print{};;; loading 0 guix/gnu/packages/abiword.scm +@print{};;; loading 1 guix/build-system/glib-or-gtk.scm +@print{};;; loading 2 guix/build/glib-or-gtk-build-system.scm +@print{};;; loading 3 guix/build/gnu-build-system.scm +@print{};;; loading 4 guix/build/gremlin.scm +@print{};;; loading 5 guix/elf.scm +@end example + +The number corresponds to the depth at which the module was loaded, +which is a recursive process. The indentation of the file name loaded +corresponds to that depth value, to make it easy to visually discern +which module caused others to be loaded. @end defvar @deffn {Scheme Procedure} current-load-port @@ -969,7 +1007,7 @@ It's better to use @code{add-to-load-path} than to modify @code{%load-path} directly, because @code{add-to-load-path} takes care of modifying the path both at compile-time and at run-time. -@deffn {Scheme Procedure} primitive-load-path filename [exception-on-not-found] +@deffn {Scheme Procedure} primitive-load-path filename [exception-on-not-found] [depth] @deffnx {C Function} scm_primitive_load_path (filename) Search @code{%load-path} for the file named @var{filename} and load it into the top-level environment. If @var{filename} is a @@ -983,7 +1021,9 @@ second argument, @var{exception-on-not-found}. If it is @code{#f}, @code{#f} will be returned. If it is a procedure, it will be called with no arguments. (This allows a distinction to be made between exceptions raised by loading a file, and exceptions related to the -loader itself.) Otherwise an error is signaled. +loader itself.) Otherwise an error is signaled. An optional third +argument, @var{depth}, can be specified to track the depth at which modules are +loaded. For compatibility with Guile 1.8 and earlier, the C function takes only one argument, which can be either a string (the file name) or an diff --git a/libguile/load.c b/libguile/load.c index 34e7934b9..77320d7dc 100644 --- a/libguile/load.c +++ b/libguile/load.c @@ -72,35 +72,67 @@ /* Loading a file, given an absolute filename. */ -/* Hook to run when we load a file, perhaps to announce the fact somewhere. - Applied to the full name of the file. */ +/* Hook to run when we load a file, perhaps to announce the fact + somewhere. Applied to the full name of the file and (since 3.10) an + optional depth counter. */ static SCM *scm_loc_load_hook; /* The current reader (a fluid). */ static SCM the_reader = SCM_BOOL_F; +/* Helper to call %load-hook with the correct number of arguments. */ +static void call_hook (SCM hook, SCM filename, SCM depth) { + if (scm_is_false (hook)) + return; -SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0, - (SCM filename), + scm_call_3(hook, filename, scm_from_utf8_keyword("depth"), depth); +} + +SCM_DEFINE (scm_primitive_load, "primitive-load", 0, 0, 1, + (SCM args), "Load the file named @var{filename} and evaluate its contents in\n" "the top-level environment. The load paths are not searched;\n" "@var{filename} must either be a full pathname or be a pathname\n" "relative to the current directory. If the variable\n" "@code{%load-hook} is defined, it should be bound to a procedure\n" "that will be called before any code is loaded. See the\n" - "documentation for @code{%load-hook} later in this section.") + "documentation for @code{%load-hook} later in this section.\n" + "A second optional argument can be used to specify the depth\n" + "at which the module was loaded.") #define FUNC_NAME s_scm_primitive_load { + SCM filename; + SCM depth; SCM hook = *scm_loc_load_hook; SCM ret = SCM_UNSPECIFIED; + if (scm_is_string (args)) { + /* C code written for 3.9 and earlier expects this function to + take a single argument (the file name). */ + filename = args; + depth = scm_from_int(0); + } + else { + /* Starting from 3.10, this function takes 1 required and 1 optional + arguments. */ + long len; + + SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, args, len); + if (len < 1 || len > 2) + scm_error_num_args_subr (FUNC_NAME); + + filename = SCM_CAR (args); + SCM_VALIDATE_STRING (SCM_ARG1, filename); + + depth = len > 1 ? SCM_CADR (args) : scm_from_int(0); + } + SCM_VALIDATE_STRING (1, filename); if (scm_is_true (hook) && scm_is_false (scm_procedure_p (hook))) SCM_MISC_ERROR ("value of %load-hook is neither a procedure nor #f", SCM_EOL); - if (!scm_is_false (hook)) - scm_call_1 (hook, filename); + call_hook (hook, filename, depth); { SCM port; @@ -1163,11 +1195,13 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, "depending on the optional second argument,\n" "@var{exception_on_not_found}. If it is @code{#f}, @code{#f}\n" "will be returned. If it is a procedure, it will be called\n" - "with no arguments. Otherwise an error is signaled.") + "with no arguments. Otherwise an error is signaled.\n\n" + "A third optional argument may be provided to track module depth.") #define FUNC_NAME s_scm_primitive_load_path { SCM filename, exception_on_not_found; SCM full_filename, compiled_thunk; + SCM depth; SCM hook = *scm_loc_load_hook; struct stat stat_source, stat_compiled; int found_stale_compiled_file = 0; @@ -1182,21 +1216,24 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, single argument (the file name). */ filename = args; exception_on_not_found = SCM_UNDEFINED; + depth = scm_from_int (0); } else { - /* Starting from 1.9, this function takes 1 required and 1 optional - argument. */ + /* Starting from 1.9, this function takes 1 required and 1 + optional arguments. From 3.10, this function takes 1 required + and 2 optional arguments. */ long len; SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, args, len); - if (len < 1 || len > 2) + if (len < 1 || len > 3) scm_error_num_args_subr (FUNC_NAME); filename = SCM_CAR (args); SCM_VALIDATE_STRING (SCM_ARG1, filename); exception_on_not_found = len > 1 ? SCM_CADR (args) : SCM_UNDEFINED; + depth = len > 2 ? SCM_CADDR (args) : scm_from_int (0); } if (SCM_UNBNDP (exception_on_not_found)) @@ -1252,8 +1289,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, scm_list_1 (filename)); } - if (!scm_is_false (hook)) - scm_call_1 (hook, full_filename); + call_hook(hook, full_filename, depth); if (scm_is_true (compiled_thunk)) return scm_call_0 (compiled_thunk); @@ -1264,7 +1300,7 @@ SCM_DEFINE (scm_primitive_load_path, "primitive-load-path", 0, 0, 1, if (scm_is_true (freshly_compiled)) return scm_call_0 (scm_load_thunk_from_file (freshly_compiled)); else - return scm_primitive_load (full_filename); + return scm_primitive_load (scm_list_2 (full_filename, depth)); } } #undef FUNC_NAME diff --git a/libguile/load.h b/libguile/load.h index 25f67b87b..d03019b44 100644 --- a/libguile/load.h +++ b/libguile/load.h @@ -27,7 +27,7 @@ SCM_API SCM scm_parse_path (SCM path, SCM tail); SCM_API SCM scm_parse_path_with_ellipsis (SCM path, SCM base); -SCM_API SCM scm_primitive_load (SCM filename); +SCM_API SCM scm_primitive_load (SCM filename_and_depth); SCM_API SCM scm_c_primitive_load (const char *filename); SCM_API SCM scm_sys_package_data_dir (void); SCM_API SCM scm_sys_library_dir (void); @@ -36,7 +36,7 @@ SCM_API SCM scm_sys_global_site_dir (void); SCM_API SCM scm_sys_site_ccache_dir (void); SCM_API SCM scm_search_path (SCM path, SCM filename, SCM rest); SCM_API SCM scm_sys_search_load_path (SCM filename); -SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found); +SCM_API SCM scm_primitive_load_path (SCM filename_and_exception_on_not_found_and_depth); SCM_API SCM scm_c_primitive_load_path (const char *filename); SCM_INTERNAL SCM scm_sys_warn_auto_compilation_enabled (void); SCM_INTERNAL void scm_init_load_path (void); diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 10423d35e..fb3d245bd 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2236,15 +2236,18 @@ name extensions listed in %load-extensions." (define %load-verbosely #f) (define (assert-load-verbosity v) (set! %load-verbosely v)) -(define (%load-announce file) - (if %load-verbosely - (with-output-to-port (current-warning-port) - (lambda () - (display ";;; ") - (display "loading ") - (display file) - (newline) - (force-output))))) +(define* (%load-announce file #:key (depth 0) #:allow-other-keys) + (when %load-verbosely + (let* ((pad-count (- 3 (string-length (number->string depth)))) + (pad (if (> pad-count 0) + (make-string pad-count #\space) + "")) + (visual-depth (if (> depth 0) + (make-string depth #\space) + ""))) + (format (current-warning-port) + ";;; loading ~a~a ~a~a~%" pad depth visual-depth file) + (force-output (current-warning-port))))) (set! %load-hook %load-announce) @@ -3250,6 +3253,10 @@ deterministic." (set-module-declarative?! m (user-modules-declarative?)) m)) +;;; This parameter is used to track the depth at which modules are +;;; loaded. +(define %current-module-load-depth (make-parameter -1)) + ;; NOTE: This binding is used in libguile/modules.c. ;; (define resolve-module @@ -3272,8 +3279,10 @@ deterministic." already) (autoload ;; Try to autoload the module, and recurse. - (try-load-module name version) - (resolve-module name #f #:ensure ensure)) + (parameterize ((%current-module-load-depth + (1+ (%current-module-load-depth)))) + (try-load-module name version) + (resolve-module name #f #:ensure ensure))) (else ;; No module found (or if one was, it had no public interface), and ;; we're not autoloading. Make an empty module if #:ensure is true. @@ -3584,7 +3593,8 @@ but it fails to load." (call/ec (lambda (abort) (primitive-load-path (in-vicinity dir-hint name) - abort) + abort + (%current-module-load-depth)) (set! didit #t))))))) (lambda () (set-autoloaded! dir-hint name didit))) didit)))))) @@ -4406,7 +4416,8 @@ when none is available, reading FILE-NAME with READER." (if compiled (begin (if %load-hook - (%load-hook abs-file-name)) + (%load-hook abs-file-name + #:depth (%current-module-load-depth))) (compiled)) (start-stack 'load-stack (primitive-load abs-file-name))))) -- 2.41.0