From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EF0xIIuriF9rOwAA0tVLHw (envelope-from ) for ; Thu, 15 Oct 2020 20:05:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gKLuG4uriF8NWQAAB5/wlQ (envelope-from ) for ; Thu, 15 Oct 2020 20:05:31 +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 0F8F49402A8 for ; Thu, 15 Oct 2020 20:05:31 +0000 (UTC) Received: from localhost ([::1]:42618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT9VC-0005MN-1q for larch@yhetil.org; Thu, 15 Oct 2020 16:05:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kT9Ss-0004WF-SS for emacs-orgmode@gnu.org; Thu, 15 Oct 2020 16:03:06 -0400 Received: from grinta.net ([109.74.203.128]:59576) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kT9Sq-0000T4-7q for emacs-orgmode@gnu.org; Thu, 15 Oct 2020 16:03:06 -0400 Received: from black.local (unknown [46.165.233.56]) (Authenticated sender: daniele) by grinta.net (Postfix) with ESMTPSA id 0A4F7ECE76; Thu, 15 Oct 2020 20:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=grinta.net; s=2020; t=1602792180; bh=Ivjx8hT/ib7GgFF213n9eGQ4xWY33DPwZk/ROSwkkJk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HLyrnEJxWcGWH93IYbH77bsnYLVYNR1SZF/3G8cxbwj0V6g9bxUosvBZfsBmsz8dZ hjAUVzbLUOp92q7HByDYqdiiubvyYi5Ooozr95zZNGKlRZXaGfbn87DlevH6lZuJAW wtCHU6G9u1sqlT1Hdi3ZZJbKRbeTL+uYG67hBq8MxVu4O0oULzrLplMoGA/C3csALN gcb3laK3982zdPTp2D+QlrDRdrH5GgNqB4b0haX+sd2MoBpwra35Ev0PLhuCt18OOQ USgf3rvVS2d66p4k5ZZ1t1XSpl8o323Poc6RAFYW+y6ZcD9I7XkcQjZtzaE6MhfJa/ f34StkSdyFkYQ== Subject: Re: org-tables with monetary amounts To: Christian Moe References: <3444a52f-36a7-6e9d-46b9-272dddc7a3ef@grinta.net> <87wo0jttxz.fsf@christianmoe.com> <87sgaj26qq.fsf@christianmoe.com> From: Daniele Nicolodi Message-ID: Date: Thu, 15 Oct 2020 22:02:58 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <87sgaj26qq.fsf@christianmoe.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=109.74.203.128; envelope-from=daniele@grinta.net; helo=grinta.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 16:03:00 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.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, LOTS_OF_MONEY=0.001, NICE_REPLY_A=-1.019, SPF_HELO_PASS=-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-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=grinta.net header.s=2020 header.b=HLyrnEJx; dmarc=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-Spam-Score: -0.01 X-TUID: +tKV7o8Ull8s On 12/10/2020 10:22, Christian Moe wrote: > > Hi, Daniele, > > Good that it's working for you. I'll try to explain the unclear parts. > > Daniele Nicolodi writes: > >> On 24/09/2020 11:17, Christian Moe wrote: >> >>> Now, with the Calc command to simplify units, you can add dollars to >>> euros and get the result in whichever currency comes first in the >>> algebraic expression >>> >>> | 3 USD | 4 EUR | 6.58 EUR | >>> #+tblfm: $3=usimplify($2+$1) >>> >>> | 3 USD | 4 EUR | 7.6511628 USD | >>> #+tblfm: $3=usimplify($1+$2) >> >> Having to explicitly use usimplify() is a bit too verbose. It would be >> ideal if this could be somehow be implicit. > > Yes, or at least with a less obtrusive syntax, like a mode flag, > something like > > $3=$2+$1;u I had a look and unfortunately the implementation of mode flags is not easily extensible, thus this cannot easily implemented in independent code. Also, it would probably make sense to have this being a Calc mode activated with an org-table formula mode flag, rather than something implemented in org-table. I don't know how easy it would be to extend Calc. >>> I don't use this functionality, so I don't have answers to all the >>> questions you'll now have -- including how to get the desired precision >>> without lopping off the currency unit in the last example! >> >> Having the desired fixed precision is quite important for this to be >> useful. In y recent tests I had to drop the units (currencies) to >> achieve this. It would be nice to find a way to avoid it. Turns our this is actually easy. There are two ways to specify visualization format for table cells: a format specifier like $3=$1+$2;%.2f which results in the units being stripped, and a Calc formatting mode flag, like $3=$1+$2;f2 which does not strip the units. Cheers, Dan