emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Error when using `org-table-field-info'
@ 2015-11-12  5:04 Junpeng Qiu
  2015-11-12 22:26 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Junpeng Qiu @ 2015-11-12  5:04 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

Hi,

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:
(org-table-get-range
             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.

Thanks,

-Junpeng

[-- Attachment #2: Type: text/html, Size: 1966 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Error when using `org-table-field-info'
  2015-11-12  5:04 Error when using `org-table-field-info' Junpeng Qiu
@ 2015-11-12 22:26 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2015-11-12 22:26 UTC (permalink / raw)
  To: Junpeng Qiu; +Cc: emacs-orgmode

Hello,

Junpeng Qiu <qjpchmail@gmail.com> writes:

> 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?

Fixed. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-12 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12  5:04 Error when using `org-table-field-info' Junpeng Qiu
2015-11-12 22:26 ` Nicolas Goaziou

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