From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Panteleev Subject: Re: [PATCH 1/3] ob-table: Fix org-sbe's handling of quotes in arguments Date: Wed, 14 Mar 2018 16:23:58 +0000 Message-ID: References: <20180307225847.24068-1-git@thecybershadow.net> <20180307225847.24068-2-git@thecybershadow.net> <87muzcans9.fsf@nicolasgoaziou.fr> <9107300b-c95d-ad16-ca03-088d173c90d9@gmail.com> <87605yn4x3.fsf@nicolasgoaziou.fr> <8258182a-5d7e-d8c9-96c2-1a76dd9e143c@gmail.com> <87fu52ln2g.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ew9CA-0003D5-VL for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 12:24:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ew9C6-0003tO-1j for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 12:24:06 -0400 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:35505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ew9C5-0003t0-QT for emacs-orgmode@gnu.org; Wed, 14 Mar 2018 12:24:01 -0400 Received: by mail-wr0-x232.google.com with SMTP id n12so5402145wra.2 for ; Wed, 14 Mar 2018 09:24:01 -0700 (PDT) In-Reply-To: <87fu52ln2g.fsf@nicolasgoaziou.fr> Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: emacs-orgmode@gnu.org, Vladimir Panteleev On 2018-03-14 15:00, Nicolas Goaziou wrote: > Vladimir Panteleev writes: >> I wrote about this in the cover letter too. $"foo" and $ "foo" are >> both the same thing. > > Just to make it clear: I read the cover letter. My confusion doesn't > come from the fact I may not have read it. In that case, I need to apologize for not making it sufficiently clear, as we're reiterating the same points without making much progress. > I disagree. You are testing an implementation detail here: the fact that > "$" is not necessarily a prefix. According to the docstring, it should > be, so the test should use that, too. What if we rewrite `org-sbe' at > some point? I'm sorry if I didn't explain it properly in my previous messages. I'll try again. The fact that $"foo" and $ "foo" mean the same thing is not an implementation detail of org-sbe. It is a consequence of Emacs Lisp grammar. Try evaluating '($"foo") and '($ "foo") in M-:. You will get the same result, because after tokenization, their representation is identical. The whitespace between $ and "foo" is completely insignificant. In fact, if you try to evaluate $"foo" by itself, you will get "Trailing garbage following expression", because, as I mentioned before, $ and "foo" are two distinct tokens. There is absolutely nothing that anyone could change in org-sbe that would make $ "foo" mean something other than $"foo". So, whether the test case has a space between $ and "a\"b\"c" is as relevant as whether it has comments, or uses tabs instead of spaces for indentation. I hope this explanation can put this issue to rest. > The same goes for the next string. $"foo", or in your case, $"a\"b\"c" > means nothing in `org-sbe' context. A reference should follow the dollar > character, per `org-sbe' docstring. I suggest to make an equivalent test > with, e.g., $"@1$1", where @1$1 refers to a field containing "a\"b\"c" > or some such. As I've mentioned, table references are resolved before org-sbe is invoked. By the time org-sbe begins executing, all table references will have already been replaced by string literals. Using a table reference confounds the matter because it is testing more than just org-sbe. org-sbe's docstring is misleading: $ is not a way to quote just table references, but any string literals in general. Had it been otherwise (i.e. $-prefixing being part of the table reference syntax), there would be no way to pass a string literal (which isn't an interpolated table cell value) to the indicated function. The doc string should probably be improved in this regard. Adding a test which uses a table reference instead of a string literal won't hurt, but it would be testing several layers at once, and, assuming cell value interpolation into emacs lisp table formulas is already tested somewhere else, superfluous. -- Best regards, Vladimir