From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AJs7H4Rp+GAKOwEAgWs5BA (envelope-from ) for ; Wed, 21 Jul 2021 20:37:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OEPxGoRp+GA/KwAA1q6Kng (envelope-from ) for ; Wed, 21 Jul 2021 18:37:56 +0000 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 F20022C1C1 for ; Wed, 21 Jul 2021 20:37:55 +0200 (CEST) Received: from localhost ([::1]:36850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6H6R-0001pq-1C for larch@yhetil.org; Wed, 21 Jul 2021 14:37:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50120) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6H63-0001ph-6O for emacs-orgmode@gnu.org; Wed, 21 Jul 2021 14:37:31 -0400 Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]:64666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6H61-0000A5-Az for emacs-orgmode@gnu.org; Wed, 21 Jul 2021 14:37:30 -0400 Received: from [IPv6:2a01:e35:39f3:4610:ac07:8be0:fb0a:ad17] (unknown [IPv6:2a01:e35:39f3:4610:ac07:8be0:fb0a:ad17]) by smtp6-g21.free.fr (Postfix) with ESMTPS id 873E3780313; Wed, 21 Jul 2021 20:37:24 +0200 (CEST) Subject: Re: [PATCH] bad table formula recorded in some cases To: Timothy References: <43910853-03cb-c226-f46d-4736d0e6cca6@free.fr> <8735s8rld9.fsf@gmail.com> <87zgufr9ha.fsf@gmail.com> From: tbanelwebmin Message-ID: <16b9f3e9-14cf-db32-28fc-f33eb035b39b@free.fr> Date: Wed, 21 Jul 2021 20:37:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87zgufr9ha.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Received-SPF: pass client-ip=2a01:e0c:1:1599::15; envelope-from=tbanelwebmin@free.fr; helo=smtp6-g21.free.fr X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.117, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626892676; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fAuy42viRUTMC8uR90FcjNiYkzJ2ggKKMkDrXW1gveE=; b=YiysJ4TIIwavKfRE87+RZuEOMg6dMuate0sGsluiau+iIgq7vC30+LCR8BirH8A8L+kD7p WrvPk+CyOLQ5/SY4Oe7nCsOWjj91jKzyz0VefAIrepnxoAjDEc2KouZg2++mYHS3cyWw1o 7GmFj5Q/J8Evn4n/Wq6cKcsTUBR+JevOEOvcuu2NxlBlCLVOgIk3ryodEFNo83th87Ec4G AFGTu5HInjFcJrX8kFR3e3M23p30gaqx25YwQ9rBTJ/zKLGjuAgmMGOZvNxAuQq1ZREP7F yauzf9uwBJFPG/o4LZPig8OslyRR5jSE/PTdZ22v+tZ6TrV9MyAjWy9Jnd5FiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626892676; a=rsa-sha256; cv=none; b=ZHCTMM+p3i1aZI8CCRZ2xUuBuBlwuofHBJBkuw6VXS1keDA4avCzvyUIzOSkAuQ38/Wv2z 6RIgy2iFdHUD+9+kC0cMgGmS6MyjWDdy5yG/8mI2mR8T8iLwnok9kHiX096oUSECs1OrsL s6nTpWpEaTroziJoR5su43E//dvXMFAwkOAor55++qFaeBmy6XdpkOI00hYBd36xDL8QEM jUDhzFIiw8rrPqS7XWsx9tTeyD3HwyfsTrOFJ/H7GdV8rbYhHifPI9GrujKKtU+s0Hq5Fp md+XECJMHxfq7xsL0otKyLzo1EcsN1TdTaRk93LzDVpfLHx8EXJ7A0Lj1M7x3g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.31 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=free.fr (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: F20022C1C1 X-Spam-Score: -2.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3qxhOw17YVBQ Ok, Timothy, fair enough Le 21/07/2021 à 17:07, Timothy a écrit : > Hi Thierry, > > tbanelwebmin writes: >> I don't know the intention. But the answer may lie in the comment 4 >> lines above: >> ;; Don't overwrite TBLFM, we might use text properties to >> ;; store stuff. >> >> In this case, the intention would be to keep the original "#+TBLFM:" >> instead of inserting a fresh new one. >> >> But we are in the else branch of (if (looking-at ...)), which means >> there was no "#+TBLFM:". And no text properties to save. Therefore we >> may safely remove this (match-string 2). > Thank you for looking into this, I'm reassured by your inference that > this change is safe to make. I'm not really one of the main > contribution-acceptors/pushers though, so I'd rather leave this for > someone like Nicolas to sign off on. > > Would you mind bumping this thread in a few weeks if nothing happens? > > Hope that's not too much of an inconvenience, > > Timothy. > >> Le 21/07/2021 à 12:50, Timothy a écrit : >>> Hi Thierry, >>> >>> Thanks for this! Looking at the change you suggest, do you know why the >>> (match-string 2) bit might have been added in the first place? I'm just >>> wondering if there might be some edge-case adversely affected by this --- >>> hence trading one bug for another :P >>> >>> -- >>> Timothy >>> >>> tbanelwebmin writes: >>> >>>> Small bug, small fix. >>>> >>>> Suppose we have a table embedded in a begin-end block. >>>> >>>> #+begin: aaa :param value >>>> | a | b | >>>> | a | b | >>>> #+end: >>>> >>>> Suppose we want to add a formula, with C-c = >>>> We end up with an incorrect result: >>>> >>>> #+begin: aaa :param value >>>> | a | 33 | >>>> | a | b | >>>> :param value $2=33 >>>> #+end: >>>> >>>> The fix: in org-table.el, line 2177, change >>>> (insert (or (match-string 2) "#+TBLFM:"))) >>>> to >>>> (insert "#+TBLFM:")) >>>> >>>> Then we get the correct result: >>>> >>>> #+begin: aaa :param value >>>> | a | 33 | >>>> | a | b | >>>> #+TBLFM: $2=33 >>>> #+end: >>>> >>>> Why? Because (match-string 2) is supposed to refer to the (looking-at) >>>> instruction 7 lines above. But (match-string 2) is in the else branch, >>>> which means that (looking-at) failed. Therefore (match-string 2) returns >>>> garbage. >>>> >>>> Thanks to Uwe Brauer for pointing to this bug.