emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Junpeng Qiu <qjpchmail@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Error when using `org-table-field-info'
Date: Thu, 12 Nov 2015 00:04:43 -0500	[thread overview]
Message-ID: <CAKzohg+2eU474+rcAzKwjYk2Vcj1p-9zvbYkMqwDhta8WAa02Q@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2015-11-12  5:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  5:04 Junpeng Qiu [this message]
2015-11-12 22:26 ` Error when using `org-table-field-info' Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKzohg+2eU474+rcAzKwjYk2Vcj1p-9zvbYkMqwDhta8WAa02Q@mail.gmail.com \
    --to=qjpchmail@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).