From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junpeng Qiu Subject: Error when using `org-table-field-info' Date: Thu, 12 Nov 2015 00:04:43 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1145aaa2af4f7a052450e2ea Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwk4K-0005CT-6Q for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 00:05:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zwk4F-0007oN-QR for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 00:05:08 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:35627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zwk4F-0007oD-Jr for emacs-orgmode@gnu.org; Thu, 12 Nov 2015 00:05:03 -0500 Received: by wmdw130 with SMTP id w130so138898722wmd.0 for ; Wed, 11 Nov 2015 21:05:02 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a1145aaa2af4f7a052450e2ea Content-Type: text/plain; charset=UTF-8 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 --001a1145aaa2af4f7a052450e2ea Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

Here is an example to repr= oduce the error:

| 1 |=C2=A0=C2=A0 |
#+TBLFM: $2=3D$1

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

Am I not suppos= ed to use the table like this?

M-x org-version output: Or= g-mode version 8.3.2 (8.3.2-32-g73a5c2-elpa @ /home/qjp/.emacs.d/elpa/org-2= 0151109/)

---------------------------------- Separator --= ---------------------------------
The following is my debugging pr= ocess. Maybe useful.:-)

Looking at the backtrace, I found the code w= ill call
(org-table-expand-lhs-ranges '(("2" . "$1&qu= ot;)))

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 t= he table. I guess here we want to convert the column formula($2=3D$1) to a = bunch of field formulas.

However, the expression looks li= ke this:
(org-table-get-range
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0lhs org-table-current-begin-pos 1 nil 'corners= )

where `lhs' is 2, and the `lhs' will be convert= ed to "@2" in `org-table-get-range' function, and used as a r= ow reference. I think this is the reason why the error happens. We only hav= e one row, so "@2" will cause the error in `org-table-get-range&#= 39; function. If now we change the above table to:
| 1 |=C2=A0=C2=A0 || 1 |=C2=A0=C2=A0 |
#+TBLFM: $2=3D$1

The error disap= pears.

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

Thanks,

-Junpeng
--001a1145aaa2af4f7a052450e2ea--