emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Specification for org-table formula mode string
@ 2020-10-19 21:54 Daniele Nicolodi
  0 siblings, 0 replies; only message in thread
From: Daniele Nicolodi @ 2020-10-19 21:54 UTC (permalink / raw)
  To: Org Mode List

Hello,

I am looking at the parsing of org-table formula mode strings and I find
it quite confusing and I have an hard time understanding if it works the
way it does by design or by accident.

Formula mode strings are documented here

https://orgmode.org/manual/Formula-syntax-for-Calc.html#Formula-syntax-for-Calc

but the specification is not very strict and the parser implements
surprising behaviors. Would it make sense to tighten the specification
and the implementation?

I think being a bit more strict is what is accepted would help catching
typos and mistakes, but I am not sure that having formulas resulting in
#ERROR upon an org-mode upgrade is desirable. Also, maybe a specific
marker (#INVALID ?) should be used for invalid syntax.

The main problem with the current parsing code is that any character
that is not recognized as a valid mode flag is used as a value format
string. For example:

| 1 | 2 | OO3.000 |
#+TBLFM: $3=$1+$2;FOO%.3f

Is this by design? If so, what is the use case?

Thus is slightly more surprising:

| 1 | 2 | 3.000 OO |
#+TBLFM: $3=$1+$2;%.3f FOO

I argue the first form should result in an error. The second can either
result in an error or in everything following the % sign to be used as a
format string, although I am not sure there is a clear use case for this.

Thank you.

Cheers,
Dan


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-19 21:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 21:54 Specification for org-table formula mode string Daniele Nicolodi

Code repositories for project(s) associated with this 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).