[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Error when using `org-table-field-info'

From: Junpeng Qiu
Subject: [O] Error when using `org-table-field-info'
Date: Thu, 12 Nov 2015 00:04:43 -0500


Here is an example to reproduce the error:

| 1 |   |
#+TBLFM: $2=$1

When I invoke `org-table-field-info' in the table above, I got following error:
args-out-of-range [nil 0] 2

Am I not supposed to use the table like this?

M-x org-version output: Org-mode version 8.3.2 (8.3.2-32-g73a5c2-elpa @ /home/qjp/.emacs.d/elpa/org-20151109/)

---------------------------------- Separator -----------------------------------
The following is my debugging process. Maybe useful.:-)

Looking at the backtrace, I found the code will call
(org-table-expand-lhs-ranges '(("2" . "$1")))

Then inside `org-table-expand-lhs-ranges' function, there is a `cond' _expression_, and the pattern will fall into the last branch, which calls `org-table-get-range' to get a range in the table. I guess here we want to convert the column formula($2=$1) to a bunch of field formulas.

However, the _expression_ looks like this:
             lhs org-table-current-begin-pos 1 nil 'corners)

where `lhs' is 2, and the `lhs' will be converted to "@2" in `org-table-get-range' function, and used as a row reference. I think this is the reason why the error happens. We only have one row, so "@2" will cause the error in `org-table-get-range' function. If now we change the above table to:
| 1 |   |
| 1 |   |
#+TBLFM: $2=$1

The error disappears.

In fact, as long as the number of rows are larger or equal to the largest column number that we reference in the table formula, there is no error. In the first example, 1<2 but in the second example 2==2.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]