[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] org-table: Add mode flag to enable Calc units simplification
From: |
Kyle Meyer |
Subject: |
Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode |
Date: |
Tue, 24 Nov 2020 00:35:47 -0500 |
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/
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Daniele Nicolodi, 2020/11/07
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Kyle Meyer, 2020/11/22
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Daniele Nicolodi, 2020/11/23
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Kyle Meyer, 2020/11/23
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Daniele Nicolodi, 2020/11/23
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode,
Kyle Meyer <=
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Daniele Nicolodi, 2020/11/24
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Kyle Meyer, 2020/11/24
- Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Christian Moe, 2020/11/25
Re: [PATCH] org-table: Add mode flag to enable Calc units simplification mode, Daniele Nicolodi, 2020/11/23