From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GMJCLl41PWPlXQAAbAwnHQ (envelope-from ) for ; Wed, 05 Oct 2022 09:42:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cPiCLV41PWOIBgAAG6o9tA (envelope-from ) for ; Wed, 05 Oct 2022 09:42:22 +0200 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 A0B2A10CCF for ; Wed, 5 Oct 2022 09:42:21 +0200 (CEST) Received: from localhost ([::1]:47474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofz2p-0001ul-Th for larch@yhetil.org; Wed, 05 Oct 2022 03:42:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofyxX-00015P-7H for emacs-orgmode@gnu.org; Wed, 05 Oct 2022 03:36:57 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:43670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofyxT-0004F9-7Y for emacs-orgmode@gnu.org; Wed, 05 Oct 2022 03:36:49 -0400 Received: by mail-pl1-x630.google.com with SMTP id z20so8203685plb.10 for ; Wed, 05 Oct 2022 00:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=uEm96Bvy7rfEqVHuJSW2Ie1/xWSsbtH1z7E/45sdT6k=; b=A5AbJckwdGk3MvWlDuqip3h/rbEUjqBTTeyAtGSG+0BNxXzQQyeiyR+6JQjjNEFhxj hiLRwfPVTjoq28BQTdEqJn40DvLi2EyI4V+CNulfVbexoW5lwpof9zFYlS6c5QRDtgOl ayeKA7/6UXK19hXzHYpMRoCfbvyEDsmBsaVsVWiAbO/hC+GJz9aeu+qqabmxOb4KCzB5 VdNhuUHt0MDK+cH76EsYvOA8ikiZ3WQPQ5GVZtfozpxeRNOu44mV25lElVwfh8i0NaNX ON5EMtfUFL9OCgvc4QUJln9aDHu/pwIR8zIHn/FoU3t0BXuuWFoD/rrUkypVDvSENvPj Neeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=uEm96Bvy7rfEqVHuJSW2Ie1/xWSsbtH1z7E/45sdT6k=; b=CiLERBKsYE2lm8sj9+PRDRJYpM7p4bwBuvgq6zJz8lBMQNBRFUqHWFHznXBG5eBAiq LnwDPgsUtu4pJMdwuj2jR6fQUnRoIDfxUCFtxgMMcJsdGXVXT8V5lL1ERdUIHo0NPlo9 Cdnd7qbk4zDfgGxR1LeTQ/9TVQO2cCUsvLTLbU3Ht2S3MR2qxFbYjYUL3d/tgRzNa33k lO7mrHXnOkVHM+K+wEzGbu3BIGDzWplQwLqmIlWiSr6q86GXjSNHITEbUjd2cBEU38ob NuzTuWETZJwVUbbxBH6PzM11vT28YARJhvHh4tSqaaMue3qf2pcuqG7IwEivqDn3ntBq 9rnw== X-Gm-Message-State: ACrzQf0StOR1ExharLBee/0ARDsRTjxd219No14SSajGyvNf8yQEisGv 7pYm0AAxet9VKM07mP3Txvjzlg9QAxSyn7Zn X-Google-Smtp-Source: AMsMyM4LOciwmq11ZDya2SItcBlnzB2ZCjKlMpPGFxZpcYsc7bZQZsAArRX4T+nnClccq988jKuuUg== X-Received: by 2002:a17:90b:1891:b0:20a:daaf:75e0 with SMTP id mn17-20020a17090b189100b0020adaaf75e0mr3698042pjb.109.1664955405615; Wed, 05 Oct 2022 00:36:45 -0700 (PDT) Received: from localhost ([2409:8970:af2:32f:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id a15-20020a170902710f00b001755ac7dd0asm9870101pll.290.2022.10.05.00.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 00:36:44 -0700 (PDT) From: Ihor Radchenko To: Jonas Bernoulli Cc: emacs-orgmode@gnu.org Subject: Re: Post-process table without changing result for empty table(/list) In-Reply-To: <87sfk3u1sc.fsf@bernoul.li> References: <871qrovh7g.fsf@bernoul.li> <874jwkwb4c.fsf@localhost> <87sfk3u1sc.fsf@bernoul.li> Date: Wed, 05 Oct 2022 15:37:36 +0800 Message-ID: <87y1tu90vz.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=yantar92@gmail.com; helo=mail-pl1-x630.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664955741; 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=uEm96Bvy7rfEqVHuJSW2Ie1/xWSsbtH1z7E/45sdT6k=; b=HydQUPwBq5pJYFx45HFI7+QsnRAiwFpHX2yCur8me2RD5vWeQoTzz8rgWfBrKdMqrhF+t1 cCJtM5cVvugJ+r8ctZ1iHD8tjjMmJ8b8gL23hRNIF5VqbmHRxQ2gv1fejVPsGS3r1gZ6c6 k5AM3ikbx2jLDXX46zqbGrz9EWXn/zFgASz4OCRS2bXtkfLB+1p/OeBhUdYPOzsdU2V9DZ j2ohVLrRbRMdPLTV4SnHNqeMUz5Nvokva6wqHEymPBnUm++HcotZ0V7nd5/S1bP6ucWHdN lo+6nuZUlXgh3Omq4vtooxYvR2uQ5v2irlOJrsGtq7/WQRAokakJ7poPhw6LEg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664955741; a=rsa-sha256; cv=none; b=E6kWxGwUNSD6OPANmxKnbU+APjVaaoNSev+N0IWZTGjnxXMRAXm9d2mNKowtFlic92aWuW dRBmKc3Cl/zpZXfqbgDJO5tEQuPLd5JGh5KjGzF+QmiU/mGNODSQ/4vqokK2JjoNmhqZPN LdXikODhnqWLeKi8GtRhDvLzXL/30mepnOlAG2Rj0wabAvQ6WTl8jH/QXxS4irNstkUnJ6 08r6iK1stBqsD4Cx3/3q5QES6mjgSwBTq3H8tAYbcyO/RRNSr9BUE7sU27C3k2X7mkDg6u 1WWKHN/IOG0gjIpq1+YKWyfoHOWmUnBPgTzNmOx9WcTUggDrmBkbnL8R8O860g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=A5AbJckw; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Spam-Score: -1.86 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=A5AbJckw; dmarc=pass (policy=none) header.from=gmail.com; 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" X-Migadu-Queue-Id: A0B2A10CCF X-Spam-Score: -1.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: PfaaW0gXugAi Jonas Bernoulli writes: >>> In the long run you might want to consider not turning any symbols >>> into strings, at least not when the "regular" block as well as the >>> post-processing block both use elisp. >> >> This may be tricky. Introducing any kind of special case will make the >> code fragile. We should better make things as generic as possible. > > By "special case", do you mean "just for elisp", or "if both use the > same language, whatever that might be"? IMO it would be best if as much > information were preserved between the two code blocks, and when they > use the same language, that should be "all of it", or nearly. Either way. It's not like I am against the idea. Rather (1) afraid to over-complicate the already complex babel code; (2) afraid to break something non-trivial. If we do it, I'd prefer same language / same language. Basically, as generic as possible approach that will be easier to maintain. > If they use the same language that might be fairly easy to do (bypass > the code that previously prevented it), but of course it would be > preferable if all type information were preserved between any two block. > > But that would be harder, which is why I would suggest to first/only do > it if the same language is used by both blocks. The actual suggestion > to do it only if both block use elisp, was more about first trying it > with the language we are most familiar with. I wasn't trying to imply > it should only be done for that language. Of course, if initially only > doing for elisp actually makes it harder, then doing it for all > languages at once, would be preferable. I do no like to make things elisp-specific, unless you can fit it into ob-emacs-lisp.el. For more generic things, we also need to be careful and not break anything. > Speaking of other languages, when I investigated the above issue, I > tried whether the issue was maybe limited to post-processing blocks that > use elisp. So I also tried doing it using python, but it turned out > that that had the same issue, and additionally there was a somewhat > related, python specific, bug: > > `org-babel-script-escape' doesn't handle an empty python list correctly: > "['a']" => ("a") > but > "[]" => [] > I.e., an empty python list is turned into an empty lisp vector instead > of an empty lisp list. At least for python, (> (length str) 2) should > probably be changed to use >=. Patches welcome. But please change the subject in the email containing the patch for easier tracking. > --- > > And while reproducing that issue just now, I ran into an additional, > unrelated issue. I didn't have python installed and when I tried to > evaluate a python block directly, that resulted in an error as expected. > However, when I evaluated a elisp block, which uses a post-processing > block that uses python, that failed silently. It would help if you can provide a reproducer. Also in a branched thread. -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92