|
From: | Thierry Banel |
Subject: | Re: [O] make orgtbl-ascii-plot easier to install |
Date: | Tue, 26 Aug 2014 23:42:31 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Le 26/08/2014 22:27, Nicolas Goaziou a
écrit :
Good !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. Do you recommend to stay away from CL & CL-LIB for ORG stuff ? `DOLIST' comes from CL as well... 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? 1st case: a header and several hlines. In this case, values 1,2,3 will be ignored. | header | |--------| <-- leading hline: skipped | 1 | | 2 | | 3 | |--------| <-- next hline: ignore whatever is before | 4 | | 5 | | 6 | 2nd case: no header at all, values in boxes. Values 1,2,3 will be ignored as well. |--------| <-- leading hline: skipped | 1 | | 2 | | 3 | |--------| <-- next hline: ignore whatever is before | 4 | | 5 | | 6 | |--------| <-- last hline Good use-case !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) |--------| <-- ignoredBut 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. Now I am not sure what to do anymore. There is already a heuristic algorithm in org-table to apply column-formulas. It does a good job at avoiding computing the formula for headers. Maybe I should mimic it. Header surrounded by hlines: |--------+----| | Header | | <-- formula not applied |--------+----| | 1 | 10 | <-- $1*10 | 2 | 20 | <-- $1*10 |--------+----| | 3 | 30 | <-- $1*10 | 4 | 40 | <-- $1*10 #+TBLFM: $2=$1*10 Header over several lines, no top-hline: | Head1 | | <-- formula not applied | Head2 | | <-- formula not applied |-------+----| | 3 | 30 | <-- $1*10 | 4 | 40 | <-- $1*10 #+TBLFM: $2=$1*10 No header, just values | 3 | 30 | <-- $1*10 | 4 | 40 | <-- $1*10 #+TBLFM: $2=$1*10 The only ill-interpreted case is this one, with no header. The first values are considered as headers: |---+----| | 3 | | <-- formula not applied | 4 | | <-- formula not applied |---+----| | 5 | 50 | | 6 | 60 | |---+----| #+TBLFM: $2=$1*10 Thanks for all this feedback. Thierry |
[Prev in Thread] | Current Thread | [Next in Thread] |