From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Bug: Remote reference (@>$1) doesn't work while ($LR1) works. [7.7] Date: Thu, 27 Oct 2011 18:13:59 +0200 Message-ID: References: <87sjmgdtq8.fsf@dmxswsh.cn.lucent.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJSao-0000kr-Kb for emacs-orgmode@gnu.org; Thu, 27 Oct 2011 12:14:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJSak-0003Cn-C3 for emacs-orgmode@gnu.org; Thu, 27 Oct 2011 12:14:10 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:47686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJSak-0003CX-7P for emacs-orgmode@gnu.org; Thu, 27 Oct 2011 12:14:06 -0400 Received: by eye4 with SMTP id 4so3008645eye.0 for ; Thu, 27 Oct 2011 09:14:05 -0700 (PDT) In-Reply-To: <87sjmgdtq8.fsf@dmxswsh.cn.lucent.com> 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: Wu Feng Cc: emacs-orgmode@gnu.org Hi Wu Feng, thank your for this rather clear bug report, even including the correct analysis. And Christian, thanks for confirming that this is a bug. As already suggested by Wu Feng, this error is caused by a premature expansion of @>$1, while still inside the context of table 2. In that context, @>$1 expands to @2$1 and then accesses the wrong field in table 1. This should be fixed now, please verify. Thanks! - Carsten On 26.10.2011, at 10:47, Wu Feng wrote: > Hello, > > First, please check below simple example, I defined two tables (T1 and > T2). In table-2, I remotely refer to the @>$1 (last row, column 1) and > $LR2 (last row, column 2) of T1. > > #+TBLNAME: T1 > | 11 | 12 | > | 21 | 22 | > | 31 | 32 | > > #+TBLNAME: T2 > | xxx | xxx | xxx | xxx | > | # | 21 | 32 | | > #+TBLFM: @>$3=remote(T1,$LR2)::@>$2=remote(T1,@>$1) > > Obviously, the expected results are: > > - remote(T1,@>$1) is replaced by 31 > - remote(T1,$LR2) is replaced by 32 > > But I got 21 for remote(T1,@>$1). The $LR version works perfectly > (though the manual says $LR is out-dated) > > Below are debug info when evaluating remote(T1,@>$1). Looks like @> in > the remote reference is mapped to the last row of the current table, not > of the remote table. > > Substitution history of formula > Orig: remote(T1,@2$1) > $xyz-> remote(T1,@2$1) > @r$c-> (21) > $1-> (21) > Result: 21 > Format: NONE > Final: 21 > > Emacs : GNU Emacs 23.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.6) > of 2011-09-13 on shirley > Package: Org-mode version 7.7 >