From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id OMuqKcCgO2N4UAAAbAwnHQ (envelope-from ) for ; Tue, 04 Oct 2022 04:56:00 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iB2pKcCgO2MOoQAAauVa8A (envelope-from ) for ; Tue, 04 Oct 2022 04:56:00 +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 4FFA938EAF for ; Tue, 4 Oct 2022 04:56:00 +0200 (CEST) Received: from localhost ([::1]:42266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofY6B-0007QO-60 for larch@yhetil.org; Mon, 03 Oct 2022 22:55:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofY5D-0007Py-7Q for emacs-orgmode@gnu.org; Mon, 03 Oct 2022 22:54:59 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:36562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ofY5B-0006Se-F7 for emacs-orgmode@gnu.org; Mon, 03 Oct 2022 22:54:58 -0400 Received: by mail-pl1-x633.google.com with SMTP id c24so11469881plo.3 for ; Mon, 03 Oct 2022 19:54:57 -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=wMOhp8dGKy5no/gxdcKaxZgj62mniNE9dQqMR/ukrME=; b=OIA+Y2v3q5sDIjfCuTTjJJIUhnstD1UBT8I1I/8Y6Clcnpg4oAgHF23y1k0Pb+ZvQp E9bF9ZUkzXW7z1AxEZ1vUocozu2evG0/r6VDoBXGlGAZ0pIF3OsRXbWUkBEYxPfE2KqZ +Mz+J5VB7DqNa0lOdIMDaNwK+dzxAFFdS8BSl3rcRmJ2ZYIfOqCTtculVw5oyKjk97qE fEVxwFESncFR/Ur1a+JeqEtg4vFU6GMqZulW0z/NVnvf7aG6I3SywfhtjTurEmsHRPgf yWr16zlVRs8owha8S3mP1rLLq1NWHnWhbQf5TXcU1e8AHawecRQqzdLD1sCuC3IVw5uW H+dw== 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=wMOhp8dGKy5no/gxdcKaxZgj62mniNE9dQqMR/ukrME=; b=ApiVZVxKb9j93nPoQBoD+PJ2LcwtCOdQwJ5Rm7fbp6YXipzGEWintxuNpghO/dAw0i FpTgxf1ioj4e69VNT27oAVOy1MaxspSGAhBjvoOVe0wOt2wS0HesifjXtME80emnqBD4 HLWtwFwvyC5L2H5eJuLEewdR/r0AJpMSxTxqhj39+rtVPOP1dXq9FEgg6nFeM+Ww+p09 /dpyGC/EVopxP4eJ3St/kFe+YnDapg09/zo+x6ZigWD8Ef62V/ZgXzXXkuWrZ9qZBcui x+qEmJ0kVLSmm5WDTP23THXUJTNluxof1NzYD45Lq6KX9B05dhtP3/E7RcinDlRInWMA GnNg== X-Gm-Message-State: ACrzQf2L2+8c4wBcquXR8TLQHOCBOYCk1n2ZXJtmybV/O2ls2r+lOuhV 1bhh57TkC14sNEJ1WcuXqUzS8srW6hX/kIHj3ro= X-Google-Smtp-Source: AMsMyM58IOJaMK4OWxTM64qlom37hqg2yWlcU7yG1qf18xOvcYvjgH+P/rt7yTgolMEBN1+vneHCJQ== X-Received: by 2002:a17:90a:3f89:b0:205:a54e:2db8 with SMTP id m9-20020a17090a3f8900b00205a54e2db8mr14778766pjc.36.1664852094490; Mon, 03 Oct 2022 19:54:54 -0700 (PDT) Received: from localhost ([1.83.154.214]) by smtp.gmail.com with ESMTPSA id f19-20020a63de13000000b00434e1d3b2ecsm7317238pgg.79.2022.10.03.19.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 19:54:53 -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: <871qrovh7g.fsf@bernoul.li> References: <871qrovh7g.fsf@bernoul.li> Date: Tue, 04 Oct 2022 10:55:47 +0800 Message-ID: <874jwkwb4c.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=yantar92@gmail.com; helo=mail-pl1-x633.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=1664852160; 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=wMOhp8dGKy5no/gxdcKaxZgj62mniNE9dQqMR/ukrME=; b=iKKahzP0EwQs0vJWC2XFKijyUwqaWYv+kp52yiyeTnsUpAhFO18xbRS8V+gdj/R0C7oIyB CJwlPF0BgXlojmUSN4T7yn87cv+oKx3pxvHS+GO1HeIrY9CQ+qmPCnESPBCnLJq3NA1o6m KuxVs+Gk8n0xH0BiScZAlGuiSpg12Rc+FdUFtk5P/yD3JIcVPH75oIBtt2XNcq7BoSP10q BRVYU1RRXaehK58BnroGAR3duRTanMu8konGxkB5DeALZKGimAqAqwUWhdtQhomtNSforS R5GMa2NaHiv7f+WVhH7ML9HIw7ejEcl4AS5HGyvs3cx8F3qqk+SRFJt/1c/X2Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664852160; a=rsa-sha256; cv=none; b=lHkouu9crFcMRnYZJWHCpoCcDkV3Du72STmjDiB/sS5xCyRcGzpD9O6WvLpY49GhBGKKP2 XJQFROBNQUgssHfrfLzkUSfMZ/670dd8av0GJFUv7miBtdKUDEJpINY7ehMBVkrvDCIJHC vwwrTkLXI0ZnOVuphVlkZz470+QNrFU3DkcDF8wEZvZeISGtlNsaXNI0DEsW5IreZ1lNCW d9/7ljMP1hNACHY7ddzmaOgG8yDk7Vi6YmTpvuKTXTP5MowpygnS7x2/gFHwqgf2BdRRNA +pHFNBNYyYEuNWjqfHrC3276VM3np6wChMnPMavVl8ROSQoJhZpBvKW+p4K6Ig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OIA+Y2v3; 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=OIA+Y2v3; 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: 4FFA938EAF X-Spam-Score: -1.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: QKsIa1ciGM62 Jonas Bernoulli writes: > It used to behave like that before 51a628bc5efc from 2009, which started > turning all symbols, including nil, into strings, but without giving any > reason why that should be done. > > It has worked like this for a long time now, so reverting that is > probably not feasible in the short run. However, I feel it would > make sense to change now how nil/'() is treated. Currently it is > being treated as the symbol nil, but IMO it would make more sense > to treat it as the empty list. That could be achieved with > > diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el > index b79e47900..2b4a16aea 100644 > --- a/lisp/ob-ref.el > +++ b/lisp/ob-ref.el > @@ -199,7 +199,7 @@ (defun org-babel-ref-resolve (ref) > (org-babel-execute-src-block nil info params)))) > (error "Reference `%s' not found in this buffer" ref)))) > (cond > - ((symbolp result) (format "%S" result)) > + ((and result (symbolp result)) (format "%S" result)) > ((and index (listp result)) > (org-babel-ref-index-list index result)) > (t result))))))))) Looks reasonable. Could you please prepare a patch and possibly also add a test that covers your use-case to testing/lisp/test-ob.el? See https://orgmode.org/worg/org-contribute.html > 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. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at