From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oF3tAMl0ZmQgPgEASxT56A (envelope-from ) for ; Thu, 18 May 2023 20:56:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yHGxAMl0ZmSG5QAAauVa8A (envelope-from ) for ; Thu, 18 May 2023 20:56:09 +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 9BB111494A for ; Thu, 18 May 2023 20:56:08 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzime-00062O-4u; Thu, 18 May 2023 14:55:28 -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 1pzimb-0005oj-W0 for emacs-orgmode@gnu.org; Thu, 18 May 2023 14:55:26 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzimZ-0001P8-6x for emacs-orgmode@gnu.org; Thu, 18 May 2023 14:55:25 -0400 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f4449fa085so15279115e9.0 for ; Thu, 18 May 2023 11:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684436120; x=1687028120; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4n5NdDy9gEKTBbFX3RRC35puFvKm2/U4pgEiD1kyLO4=; b=IkcZn6QyJ0bFxg9Wgq80D30kft6eeKIRlAK44MD+WjpRKbFdGnGhDwZnnBDin/UKPF wdH7JB940Sp5r/6YPw4wwMY3+ivaFxm9XY5nWatDO3Ie8pr5PktbnvBgIH7FMRb/2HUY IaoYPGAgvAY8tGuKw9lnDQ1gU+h3WRqyrKwCHEhXjiU8MDGZ7tFJ1BCGKqaEFhC5fBBu PKD4VtZyJi9DfRX4J2FfYF/a27ohNUKObyZ4CvwCIWP8ketqq3jmo0gMC78CnGvWPWHT dsZOSRpCzvX2j12KaElbh7h/NFHGbFcYgcDWW7XWUsUAg/hZY/AgzygbKitAi4BZRdHP ikww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684436120; x=1687028120; h=mime-version:date:references:in-reply-to:subject:to:from:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4n5NdDy9gEKTBbFX3RRC35puFvKm2/U4pgEiD1kyLO4=; b=UgwAZuJjbmLwDem419DqenQOBwGRRbs/1+Zc/Tv2vOS3f4tvuOnOxM9pez+Gr8jCoh BzPtNDhPbnYdy47BnfSliDm4zucGPLg8+fzqHPYYDErWE+e0SIcDnyg74Yba+5/WQsHW V1z8A8H11kPwscYEHhqpo+VBhmAGYasy1Hf9KIVa6O2hxispU2ozevHtt5dF9CzhEI4c IBWKjKgrLbLqIJqiy5Tdgdy55ioiQ85vG3nfsP9eBz4zR8H/z5+HtUbPw/hSm2UkdjHH OcjufCT8GzCiXSk/jjT61408mbEHqbKmJMDvWfCBQRZ89cuirdQECWCekehGIwGqTBn2 WBEg== X-Gm-Message-State: AC+VfDxa6j+lRV4jC74Gq6Oo3zzPRwojq4qtXC9i/N4fmCq9bbEXN1DO FzCK2fCel5V5Qh47/yZhxz9hnegqV2A= X-Google-Smtp-Source: ACHHUZ6Sjvdup5TqNqw416l9ZeGMo7xjAYQEGiRNhddKexqkMnPIo+virfelF6axBdvjHFrqOSvhdg== X-Received: by 2002:a05:600c:217:b0:3f4:20bd:ba4b with SMTP id 23-20020a05600c021700b003f420bdba4bmr2541031wmi.21.1684436119876; Thu, 18 May 2023 11:55:19 -0700 (PDT) Received: from keynux ([2a01:e0a:505:3460:169:7511:f49a:58eb]) by smtp.gmail.com with ESMTPSA id l20-20020a7bc454000000b003f42e008c8dsm38677wmi.44.2023.05.18.11.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 11:55:19 -0700 (PDT) Message-ID: <64667497.7b0a0220.ca9cf.021c@mx.google.com> Received: by keynux (sSMTP sendmail emulation); Thu, 18 May 2023 20:55:17 +0200 From: Bruno Barbier To: Jeff Trull , emacs-orgmode@gnu.org Subject: Re: Formulas on table cells containing '$' In-Reply-To: References: Date: Thu, 18 May 2023 20:55:17 +0200 MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=brubar.cs@gmail.com; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684436168; a=rsa-sha256; cv=none; b=YmD1OmPrmh4+gUVHM3vIz1n0KnV7MfJ+y9qINO3IrttKqSxUJm8k+AkgBNUuAekFEso3FK eYqDcMbK+vpKhT/hPck94jL0lmwBWOpwpZZch64crYRi++rbGoj97aASVutyx99abFAs0G 96eUIgOvvmBVn9tyq9S0MgPHEA1qZpH5lo1nDfxeaK4oQvhqtU1TyC1P+D6A0IGT6bnsdf 8Thuye+ngBG2aLLHPNP4QiVvkVF1LqxwJqA8FFaSYisoDV+5UyfGxMGw2T7BaO1mW+O6rW 88be3zucwVBASCl/TEwyEVQHZEyZj8+QfTZFDIydU4/ZJbD/74svui1znm3nyQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IkcZn6Qy; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1684436168; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=4n5NdDy9gEKTBbFX3RRC35puFvKm2/U4pgEiD1kyLO4=; b=fURILrWW7SAZy1mJkcUXPlA4jlgNESMwMM72SyXq1tH0VdeiWtkLqfy1fuDQOAqYOotUWx zHCRqJNjxF3LC7NJqJgKAXC51jeQeHUQKL8VKcmKrDh/GyPD7ZGZJZNEElYvCZBeAzp+6K 490RhTZs4x17hjubP+hBmqzlKw7iLbWZ2kUmy/RIma4Tj0ouOaLKCIRkoS2YxRIWVoiand i0UOpnRPUgfBaZzjLdYmziq4yuiRjjRDN/sABF19JISNKMBOAMQMxFBpwRJDbum1REXoum MrABEn4RDcPCVIigou5F+wWjcY4p3+FhaXBK2l/iChxHMSBbtAnlud1WKb/jig== X-Migadu-Spam-Score: -9.09 X-Spam-Score: -9.09 X-Migadu-Queue-Id: 9BB111494A X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=IkcZn6Qy; 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-TUID: Q7y+eXgFdKpJ Jeff Trull writes: > While investigating an error executing a table formula I discovered that > cells containing '$' cause column references to be executed even when no > attempt is made to evaluate cell contents as code. Here's a simple example: > Confirmed. org tries first to resolve all references, recursively. '(length '(@1$3..@I$3)) { resolving @1$3..@I$3 into ("$200.00" "$1.13" "$301.22") } = '(length '("$200.00" "$1.13" "$301.22")) { resolving $200 into ... ERROR: '$200' is an invalid reference. It's probably not by designed, but, it's definitely a limitation of the current implementation. As a workaround, you could hide your reference in elisp and resolve it manually using `org-table-get-range'. That way you can add/remove "$" as needed. For example: | 3/1/2023 | Deposit | $200.00 | | 3/13/2023 | Interest | $1.13 | | 4/1/2023 | Deposit | $301.22 | |-----------+------------------------+---------| | | Number of Transactions | 3 | | | Total | $502.35 | #+TBLFM: @4$3='(length (org-table-get-range (concat "@" "1$" "3..@" "I$" "3"))) #+TBLFM: @5$3='(format "$%.2f" (apply '+ (mapcar (lambda (x) (string-to-number (substring x 1))) (org-table-get-range (concat "@" "1$" "3..@" "I$" "3"))))) Bruno