From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id CH/hN2sTF2SjYQAASxT56A (envelope-from ) for ; Sun, 19 Mar 2023 14:51:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cEn7NmsTF2RHbwEAG6o9tA (envelope-from ) for ; Sun, 19 Mar 2023 14:51:39 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9F506285C1 for ; Sun, 19 Mar 2023 14:51:38 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdtQq-00038u-FW; Sun, 19 Mar 2023 09:50:44 -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 1pdtQn-00038N-84 for emacs-orgmode@gnu.org; Sun, 19 Mar 2023 09:50:41 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdtQk-00082S-UD for emacs-orgmode@gnu.org; Sun, 19 Mar 2023 09:50:41 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1B8642401CA for ; Sun, 19 Mar 2023 14:50:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1679233827; bh=6XIp/UvtgczIFSnBRfXarlts5vAT+AV4Guy8dQoIMlg=; h=Date:Subject:To:Cc:From:From; b=kht/vsL/fKW0QEjYMStYhwh5TNPFmkrgXXrnHA7KXNetHrc62+vz8PL+KDCqXrwE3 GtiqsBXe1TLOz8oi56d4fmWBz3Gk9nLN9ED+H88f/bT7d4pb1nUs7qqQ2ZWQ26rDxQ qsXo8/I2zP6mCk12CEBMxJ8OenYwjgtHCjqC+hbMIE5Fs7R2vqQiyTKnhxMbrwFi0m rvUeYUZvd3yh4eqlvyk1Z3Gof0zeueJcC1loq/DuMIfokzCfWlfCCOVXV/QM48d8FC 8pHVdrfz5T4SxnSaqoxat8dpvEpyxM5ppZlu9nNAk3IMDgnfBkmOeATvwV0OcS2HgX rI9F4ebVVB+Dw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PffQB1gFJz9rxL; Sun, 19 Mar 2023 14:50:26 +0100 (CET) Content-Type: multipart/mixed; boundary="------------WirQBVRKTTwCLCUS3qkZyXKH" Message-ID: <9710552a-601b-8a0c-1c30-4bb2263c2739@posteo.de> Date: Sun, 19 Mar 2023 13:50:25 +0000 MIME-Version: 1.0 Subject: [PATCH] lisp/ob-scheme.el To: Ihor Radchenko Cc: Bruno Barbier , emacs-orgmode@gnu.org, Bastien References: <9eab60bc-9b82-e037-d63b-3d879573ae32@posteo.de> <87v8jceihi.fsf@localhost> <7fc63848-d6d3-80e0-ae78-00967990813d@posteo.de> <64079614.170a0220.5a0d3.0a23@mx.google.com> <97ee254e-72d2-2bdf-e026-78bde076f1f9@posteo.de> <6408e424.5d0a0220.8862a.2a62@mx.google.com> <87v8jaoz3u.fsf@localhost> <21ea836d-8bdf-2d0d-8515-283209f2eb1f@posteo.de> <878rg3y5he.fsf@localhost> From: Zelphir Kaltstahl Content-Language: en-US In-Reply-To: <878rg3y5he.fsf@localhost> Received-SPF: pass client-ip=185.67.36.65; envelope-from=zelphirkaltstahl@posteo.de; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b="kht/vsL/"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.de ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679233899; a=rsa-sha256; cv=none; b=uh/MpcZcGmOun2jlfwj3Y1UyRpN3LX245jjwHCcqJHlCOHm9eTKxb/T2lbpftYtehFY8C/ et5vpcVnpB4li9NgBGX3gbA12cyUw0xZrB8GCO30C2DYnEAAS9n3CTpH1aHqpEVYDOSHJ2 9noTP9RfAxsbRwSqK80CgjoHMF7KvA0Kl9k/PL3ZdnS/4e55z75ZseCxhaJ8U/fy2Ee6OS 4xRaCOnSkJR6VFqD2Wd2AJAT0+TWarQyvl5E/z8pDOLNzZo7KCugl5gHCTKyRIzYRDLDn4 B3vkqeyBRmiPKnxGvrQPP1h4p0ojWRcaXi9WSon7nsqto57j7NtN42h1G47c2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679233899; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=rYrSA7GIq7QB2vR7HPl7mbgJGVqVGUPCCYDk87A3SV4=; b=kYXC5Wcc9yVfrPGHN+ZVu0u9xHvQLIAA1ir0BVSJuiLWpCtxnv+iboYcM0kKZk+SkdzAtB 42E7h51k4s299mZEe9s93VVB3F18qatrSnYsKYuLuUn66ZpWhIhJSa37urIVpDcVW44VSa x9b7UwIflKye/G3ZenYtiqv0QSB30IcgoN2afKuUT0//nehnlc5J0lfsoMstD9vnD+sNg2 oTldOLUdYg2lXSn4tsUuY9HF+LFYOmqJVrSgRd60D3dLukRcTBQR6GUiaA048YQjLJrx15 /C1I6Gup2h9y8rwMgzUjbs7/BhsT3XzYOSPsmJ7mBFpD83Ih5c0CjUPxEAH8uw== X-Migadu-Spam-Score: -5.24 X-Spam-Score: -5.24 X-Migadu-Queue-Id: 9F506285C1 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.de header.s=2017 header.b="kht/vsL/"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.de X-TUID: eyO39yKOat3o This is a multi-part message in MIME format. --------------WirQBVRKTTwCLCUS3qkZyXKH Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/11/23 10:58, Ihor Radchenko wrote: > Zelphir Kaltstahl writes: > >> The issue is not with defining via (define ...) inside a (let ...) in Guile. It >> is about importing macros at the time, when the body of the (let ...) is already >> evaluated, which is at a later phase than macro expansion. By wrapping inside a >> (let ...) org has moved the import to a later phase, which causes the macro >> (let-values ...) to not be expanded. > I see. > AFAIK, Elisp does not have this problem. > >> As far as I know, (defun ...) and (defvar ...) are merely defining functions and >> variables, not macros. > Same for defmacro in Elisp. > >> My point is, that imports are usually global for sessions. But :var decided for >> let-wrapping, moving them to a different place. Just like imports are usually >> global, I would expect (define ...)s to be global in the session, unless I put >> them inside a narrowed scope like a (let ...) myself. The org generated (let >> ...) is invisible to the user and thus confusing, at least for GNU Guile. >> >> For other Schemes it probably all depends on how their phases of expansion and >> evaluation work. I don't know enough about the Scheme standards, to tell, >> whether Guile has the correct behavior here or whether there is a correct >> behavior defined in the Scheme standards. Maybe someone more knowledgeable can >> chime in to comment on that. > When saying Guile I mean scheme. Remember that I am now looking from a > more general perspective of other ob-* libraries. > > My conclusion so far is that it is not safe in ob-scheme to use > let-binding. Other ob-* lisp implementations may be OK (at least, > ob-emacs-lisp is OK). > > Now, the main question is whether it is safe to use `define' in all the > scheme implementations. If it is, would you be interested in turning > your personal fix into a patch for ob-scheme? Hi! I've created a patch, which I will attach to this e-mail. Not sure it meets all formalities. For example it is not clear to me, whether I should add the "TINYCHANGE" at the bottom of my commit message. Still need to get around to test at least some other Scheme as well, but I guess I should get started with the patch, otherwise I will procrastinate or be stuck in fear of formalities forever. Let me know, if this an OK patch or what else needs to be done or what format is wrong, if any. -- repositories: https://notabug.org/ZelphirKaltstahl --------------WirQBVRKTTwCLCUS3qkZyXKH Content-Type: text/x-patch; charset=UTF-8; name="0001-lisp-ob-scheme.el.patch" Content-Disposition: attachment; filename="0001-lisp-ob-scheme.el.patch" Content-Transfer-Encoding: base64 RnJvbSA1MWIyOTlhYTE4ZTg4MjY4MWRkNjgxYWNiNTFjOWNiMWI0NGYzYjRlIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBaZWxwaGlyIEthbHRzdGFobCA8emVscGhpcmthbHRz dGFobEBwb3N0ZW8uZGU+CkRhdGU6IFNhdCwgMTggTWFyIDIwMjMgMTY6MDY6MDUgKzAxMDA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