[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] make orgtbl-ascii-plot easier to install
From: |
Nicolas Goaziou |
Subject: |
Re: [O] make orgtbl-ascii-plot easier to install |
Date: |
Tue, 26 Aug 2014 22:27:52 +0200 |
Thierry Banel <address@hidden> 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
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/10
- Re: [O] make orgtbl-ascii-plot easier to install, Nicolas Goaziou, 2014/08/26
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/26
- Re: [O] make orgtbl-ascii-plot easier to install,
Nicolas Goaziou <=
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/26
- Re: [O] make orgtbl-ascii-plot easier to install, Nicolas Goaziou, 2014/08/26
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/26
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/27
- Re: [O] make orgtbl-ascii-plot easier to install, Nicolas Goaziou, 2014/08/27
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/28
- Re: [O] make orgtbl-ascii-plot easier to install, Nicolas Goaziou, 2014/08/29
- Re: [O] make orgtbl-ascii-plot easier to install, Thierry Banel, 2014/08/29