From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Thierry Banel <tbanelwebmin@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: make orgtbl-ascii-plot easier to install
Date: Tue, 26 Aug 2014 22:27:52 +0200 [thread overview]
Message-ID: <87vbpfnghj.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <53FCE574.3010307@free.fr> (Thierry Banel's message of "Tue, 26 Aug 2014 21:52:20 +0200")
Thierry Banel <tbanelwebmin@free.fr> writes:
> I'll change to let-binding. What is the rational for that ? Better
> byte-code ?
This is faster, indeed. Also, the scope of the binding is explicit. It
is sometimes hard to tell where the value of a setq'ed variable comes
from.
> Can I limit VALUE to numbers ? VALUE comes from a cell in the table.
> The formula line of the table looks like this:
>
> #+TBLFM: $2='(orgtbl-ascii-draw $1 1 3 12)
>
> VALUE is $1 in this formula.
> If (string-to-number VALUE) fails, it will return zero, which is not
> very harmful.
Nevermind then.
> Actually this should be `cl-most-positive-float', because everything
> here works in floating point values. Thanks for the clue.
Oh, right. Then, I wouldn't bother in this case. Org supports Emacs 23
and cl-lib is not easily available.
> Small nitpick: I suggest to use `dolist' instead of `mapc' (no funcall
> overhead).
>
> Sure, easier to read.
This is also kinda like let vs setq.
> Before hard-coding this regexp, I took a look at what was already
> there. org-table-number-regexp matches too much, for instance it
> matches:
> "<345"
> "345()"
> "345%45"
> "0x45" // hexadecimal
> "1101#2" // base two
> Anyway, the string feeds (string-to-number x) which does not accept
> all those variations. So I created a regexp exactly fitted for
> (string-to-number).
OK.
> IOW, you need to eliminate the leading 'hline, if any,and skip until
> the next 'hline if there is one and if there is something after it.
>
> Ok. Not completely fool-proof, but better.
Do you think of another case that wouldn't be covered by this?
> On the other hand, this loop searches for the min and the max of
> a column, ignoring entries which are not numbers. So it could just
> iterate over the full column, including any kind of headers.
>
> | header | <-- ignored
> |--------| <-- ignored
> | 1 | <-- used (will set min=1)
> | 2 | <-- used
> | xx | <-- ignored
> | 3 | <-- used (will set max=3)
> |--------| <-- ignored
But header and the rest of the column may be both numbers but expressed
in different units, e.g. header could be a year and column inhabitants.
FWIW, I think skipping header (when there is one) is a good idea.
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2014-08-26 20:27 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-13 16:02 make orgtbl-ascii-plot easier to install Thierry Banel
2014-07-28 14:40 ` Bastien
2014-08-10 22:22 ` Thierry Banel
2014-08-26 8:29 ` Nicolas Goaziou
2014-08-26 19:52 ` Thierry Banel
2014-08-26 20:27 ` Nicolas Goaziou [this message]
2014-08-26 21:42 ` Thierry Banel
2014-08-26 22:09 ` Nicolas Goaziou
2014-08-26 22:21 ` Thierry Banel
2014-08-27 21:35 ` Thierry Banel
2014-08-27 23:28 ` Nicolas Goaziou
2014-08-28 20:46 ` Thierry Banel
2014-08-29 9:54 ` Nicolas Goaziou
2014-08-29 17:20 ` Thierry Banel
2014-09-02 21:53 ` [PATCH] " Thierry Banel
2014-09-03 18:22 ` Nicolas Goaziou
2014-09-03 20:10 ` A key-binding for plotting Thierry Banel
2014-09-06 14:35 ` [PATCH] remap orgtbl-ascii-plot to C-c # Thierry Banel
2014-09-08 16:30 ` Nicolas Goaziou
2014-09-13 17:06 ` key-binding for all plotting styles Thierry Banel
2014-10-07 14:15 ` Nicolas Goaziou
2014-10-07 21:40 ` Thierry Banel
2014-10-11 17:46 ` [PATCH] " Thierry Banel
2014-10-12 9:28 ` Nicolas Goaziou
2014-10-12 10:00 ` Thierry Banel
2014-10-12 14:05 ` Thierry Banel
2014-10-13 16:24 ` Nicolas Goaziou
2014-10-13 21:16 ` Thierry Banel
2014-10-14 20:48 ` Thierry Banel
2014-10-14 21:08 ` Nicolas Goaziou
2014-10-14 21:26 ` Thierry Banel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vbpfnghj.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=tbanelwebmin@free.fr \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.