From: Kyle Meyer <kyle@kyleam.com>
To: Daniele Nicolodi <daniele@grinta.net>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode
Date: Tue, 24 Nov 2020 00:35:47 -0500 [thread overview]
Message-ID: <87sg8z8ggc.fsf@kyleam.com> (raw)
In-Reply-To: <eeee7c4e-ae2e-b9d9-54ee-b2d99ca54076@grinta.net>
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/
next prev parent reply other threads:[~2020-11-24 5:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-24 15:33 [PATCH] org-table: Add mode flag to enable Calc units simplification mode Daniele Nicolodi
2020-11-07 14:03 ` Daniele Nicolodi
2020-11-19 5:58 ` Kyle Meyer
2020-11-19 20:02 ` Daniele Nicolodi
2020-11-23 3:14 ` Kyle Meyer
2020-11-23 10:22 ` Daniele Nicolodi
2020-11-23 22:27 ` Kyle Meyer
2020-11-24 0:03 ` Daniele Nicolodi
2020-11-24 5:35 ` Kyle Meyer [this message]
2020-11-24 8:05 ` Daniele Nicolodi
2020-11-25 2:07 ` Kyle Meyer
2020-11-25 7:41 ` Christian Moe
2020-11-23 10:25 ` Daniele Nicolodi
2020-11-23 22:25 ` Kyle Meyer
2020-11-23 23:01 ` Daniele Nicolodi
-- strict thread matches above, loose matches on Subject: below --
2020-10-19 15:38 Bug in org-table--set-calc-mode? Daniele Nicolodi
2020-10-20 13:30 ` [PATCH] org-table: Add mode flag to enable Calc units simplification mode Daniele Nicolodi
2020-10-20 13:44 ` Eric S Fraga
2020-10-20 14:00 ` Daniele Nicolodi
2020-10-20 14:22 ` Eric S Fraga
2020-10-20 14:19 ` Eric S Fraga
2020-10-20 14:32 ` Daniele Nicolodi
2020-10-20 14:53 ` Daniele Nicolodi
2020-10-20 15:35 ` Eric S Fraga
2020-10-20 15:35 ` Eric S Fraga
2020-10-21 15:57 ` Daniele Nicolodi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sg8z8ggc.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=daniele@grinta.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).