From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 1IgHINybvF/HNAAA0tVLHw (envelope-from ) for ; Tue, 24 Nov 2020 05:36:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mFhTG9ybvF/yQQAAbx9fmQ (envelope-from ) for ; Tue, 24 Nov 2020 05:36:28 +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 E85A8940111 for ; Tue, 24 Nov 2020 05:36:26 +0000 (UTC) Received: from localhost ([::1]:49914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khR04-00067X-Bc for larch@yhetil.org; Tue, 24 Nov 2020 00:36:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khQzd-00067L-4O for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 00:35:58 -0500 Received: from pb-smtp2.pobox.com ([64.147.108.71]:54824) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khQzY-0008DJ-Qb for emacs-orgmode@gnu.org; Tue, 24 Nov 2020 00:35:56 -0500 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 7B7BF968FF; Tue, 24 Nov 2020 00:35:49 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=g3bGvZBJhNiGbEcQw+KVKVrec/I=; b=OCPNvV TsWjdOM2Pb1PpmSmF73BBqCV0MrXsO/RHRfuTCTGK+ElLdy+hL8bpQDiFZNuucaF 8mA9aoCXOZatB1R2c6fVeC28YjIhO4m/NFPb6pgp1O2Rd/v1/NlMQNt/8FzSB5Hj LYNKF/OlNZWbnbtIaMR34yovm2TqRIHZfiQLU= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 64AFE968FD; Tue, 24 Nov 2020 00:35:49 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=ChLMkEqWp+wYEnUg8d8K+weMf4xFP98xEK/TRX4mxOw=; b=klbdg1RzC0dXRy6T7rGzXHVyJyAQlZ3Dyedl7jfBzDjx6hYVyLMuJvp9PWVcxTxXS2Jf67QRJ/FFmix31+znHXI3WfxNMtLRgUhFYy1NUpOMA0koW9swDYMQbPgFzfd44K34YllVwGLH8GAbAL+TKTeX6+e8+fCl3At5erXqiXI= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id C8E25968FC; Tue, 24 Nov 2020 00:35:48 -0500 (EST) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Daniele Nicolodi Subject: Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode In-Reply-To: References: <48c15b01-341d-f4c6-7086-1a39e4977868@grinta.net> <87h7pgvk6b.fsf@kyleam.com> <938fa4a5-f162-6c03-072b-4f11546a95c8@grinta.net> <87blfnso8w.fsf@kyleam.com> Date: Tue, 24 Nov 2020 00:35:47 -0500 Message-ID: <87sg8z8ggc.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: E86A4F0E-2E16-11EB-95C6-74DE23BA3BAF-24757444!pb-smtp2.pobox.com Received-SPF: pass client-ip=64.147.108.71; envelope-from=kyle@kyleam.com; helo=pb-smtp2.pobox.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, 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: Org Mode List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=OCPNvV T; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=klbdg1Rz; 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: -1.21 X-TUID: DfQNQ8kiMwRI Daniele Nicolodi writes: > Subject: [PATCH 1/3] org-table: Remove unused org-tbl-calc-modes variable > declaration Looks good. > Subject: [PATCH 2/3] org-table: Simplify mode string parsing > and reduce scope of local variables. [...] > - (if (string-match ";" formula) > - (let ((tmp (org-split-string formula ";"))) > - (setq formula (car tmp) > - fmt (concat (cdr (assoc "%" org-table-local-parameters)) > - (nth 1 tmp))) > + (if (string-match "\\(.*\\);\\(.*\\)" formula) > + (progn > + (setq fmt (concat (match-string-no-properties 2 formula) > + (cdr (assoc "%" org-table-local-parameters)))) Hmm, the concat arguments are getting swapped. Intentional? The rest looks good. > Subject: [PATCH 3/3] org-table: Add mode flag to enable Calc units > simplification mode > > * org-table.el (org-table-eval-formula): Add the `u` mode flag to > enable Calc's units simplification mode. > > * test-org-table.el (test-org-table/mode-string-u): Add Unit test for > the new mode flag. > > * org-manual.org: Document new mode flag. > --- > doc/org-manual.org | 8 ++++++++ > etc/ORG-NEWS | 7 ++++++- > lisp/org-table.el | 5 +++-- > testing/lisp/test-org-table.el | 12 ++++++++++++ > 4 files changed, 29 insertions(+), 3 deletions(-) Thanks for the additions. > diff --git a/doc/org-manual.org b/doc/org-manual.org > index be69996d5..70b748fc7 100644 > --- a/doc/org-manual.org > +++ b/doc/org-manual.org > @@ -2075,6 +2075,14 @@ variable ~org-calc-default-modes~. > > Fraction and symbolic modes of Calc. > > +- =u= :: > + > + Units simplification mode of Calc. Calc is also a symbolic convention nit: two spaces after a period > + calculator and is capable of working with values having an unit > + (numerals followed by an unit string in Org table cells). This mode > + instructs Calc to simplify the units in the computed expression > + before returning the result. > + > - =T=, =t=, =U= :: > > Duration computations in Calc or Lisp, [[*Durations and time values]]. > diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS > index 889eb4aab..6f6db8e43 100644 > --- a/etc/ORG-NEWS > +++ b/etc/ORG-NEWS > @@ -60,7 +60,7 @@ relative links within a project as follows: > #+end_src > > ** New features > -*** =ob-python= improvements to =:return= header argument > +*** =ob-python= improvements to =:return= header argument unrelated space change > The =:return= header argument in =ob-python= now works for session > blocks as well as non-session blocks. Also, it now works with the > @@ -112,6 +112,11 @@ package, to convert pandas Dataframes into orgmode tables: > | 2 | 3 | 6 | > #+end_src > > +*** New =u= table formula flag to enable Calc units simplification mode > + > +A new =u= mode flat for Calc formulas in Org tables has been added to > +enable Calc units simplification mode. s/flat/flag/