emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG in reference by ID to remote table (was Re: org babel question: reference tables in remote file)
@ 2014-04-28  4:24 William Henney
  2014-05-30 13:44 ` Bastien
  0 siblings, 1 reply; 3+ messages in thread
From: William Henney @ 2014-04-28  4:24 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Arun Persaud


[-- Attachment #1.1: Type: text/plain, Size: 1298 bytes --]

There is an apparent bug when using the ID property to refer to cells in
remote tables, which is currently the only way to refer to a table in an
external file.

This is illustrated in the attached org file.  In brief, the bug is
triggered by any ID that contains a sequence matching the regexp
"-[A-Z]+[0-9]+-", which org wants to interpret as a spreadsheet-style cell
reference.

Also, it would be more user friendly if CUSTOM_ID properties could also be
used in this way.  Would that be easy to implement?

Will


On Thu, Apr 17, 2014 at 1:45 PM, Bastien <bzg@gnu.org> wrote:

> Hi Arun,
>
> Arun Persaud <apersaud@lbl.gov> writes:
>
> > thanks for the answer. It would be nice to be able to reference tables
> > in other files easily though, so some form of <path>:<tablename> would
> > be great for the remote call. Is there some special ref syntax that
> > could be used here?
>
>      remote(NAME-OR-ID,REF)
>
> describes a reference to a table in a section, possibly in a different
> file, and the ID property is probably more stable than a filename, so
> I'd argue that what we have is enough.
>
> --
>  Bastien
>
>


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

[-- Attachment #1.2: Type: text/html, Size: 1921 bytes --]

[-- Attachment #2: remote-ref-test.org --]
[-- Type: application/octet-stream, Size: 2544 bytes --]

#+OPTIONS: ^:{}

* Target table one
:PROPERTIES:
:CUSTOM_ID: target-table
:ID:       44C84E12-C83A-4C76-91F3-3A9C309C7DF3
:END:

#+name: target-table-1
| target1  |

* Target table two
:PROPERTIES:
:ID:       A4133231-080C-4CCB-A99B-E68666862174
:END:
#+name: target-table-2
| target2  |


* Reference to a cell in a remote table via the ID property

** Case that works
#+name: table-ref-that-works
| target2 |
#+TBLFM: @1$1=remote(A4133231-080C-4CCB-A99B-E68666862174,@1$1)
+ Directly editing the TBLFM line works
  + Evaluating the formula (e.g., with “C-c *”) will correctly copy the cell from the remote table

** Case that fails
#+name: table-ref-that-fails
| :=remote(A4133231-080C-4CCB-A99B-E68666862174,@1$1)       |
#+TBLFM: @1$1=remote(@4133231$1-080C-4CCB-A99B-@68666862174$5,@1$1)
+ But adding the remote reference with “C-u C-c =” fails
+ As does using the formula editor (“C-c '”)
+ As too does entering the formula in the cell directly with the “:=” method
+ The error is 
#+BEGIN_EXAMPLE
org-table-get-range: Args out of range: [nil 27], 4133231
#+END_EXAMPLE
+ Note that the section of the ID “-A4133231-” is converted to “-@4133231$1-” in the TBLFM line, which is presumably the source of the bug
+ Org seems to be interpreting it as a spreadsheet-style cell reference to a cell that does not exist
+ This is reminiscent of another [[http://lists.gnu.org/archive/html/emacs-orgmode/2010-03/msg00144.html][bug that Carsten fixed for me]] several years ago

** Not all IDs have this problem
#+name: some-ids-always-work
| target1 |
#+TBLFM: @1$1=remote(44C84E12-C83A-4C76-91F3-3A9C309C7DF3,@1$1)
+ [[id:44C84E12-C83A-4C76-91F3-3A9C309C7DF3][Target table one]] does not have this problem.
+ It seems that in order to trigger the bug the ID must contain a section that both
  1. Starts with a letter (or sequence of letters) rather than a digit, and
  2. Does not contain any other letters, only digits
+ From very small number statistics I would say that roughly half of IDs have these properties


** The CUSTOM_ID property cannot currently be used in the reference
| :=remote(target-table,@1$1) |
#+TBLFM: @1$1=remote(target-table,@1$1)

Error message:
#+BEGIN_EXAMPLE
user-error: Can't find remote table "target-table"
#+END_EXAMPLE

* Emacs and org versions tested
#+BEGIN_SRC elisp
(emacs-version)
#+END_SRC

#+RESULTS:
: GNU Emacs 24.3.1 (x86_64-apple-darwin13.1.0, Carbon Version 1.6.0 AppKit 1265.19)
:  of 2014-04-22 on iris.local

#+BEGIN_SRC elisp
(org-version)
#+END_SRC

#+RESULTS:
: 8.2.5h


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

* Re: BUG in reference by ID to remote table (was Re: org babel question: reference tables in remote file)
  2014-04-28  4:24 BUG in reference by ID to remote table (was Re: org babel question: reference tables in remote file) William Henney
@ 2014-05-30 13:44 ` Bastien
  2014-05-31  9:30   ` William Henney
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2014-05-30 13:44 UTC (permalink / raw)
  To: William Henney; +Cc: Arun Persaud, emacs-orgmode

Hi William,

William Henney <whenney@gmail.com> writes:

> There is an apparent bug when using the ID property to refer to cells
> in remote tables, which is currently the only way to refer to a table
> in an external file.

One way to deal with this is to set

(setq org-table-use-standard-references nil)

Since the default value for the variable is not nil, we could also
consider preventing the conversion in remote(...) formulas.

What do you think?

-- 
 Bastien

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

* Re: BUG in reference by ID to remote table (was Re: org babel question: reference tables in remote file)
  2014-05-30 13:44 ` Bastien
@ 2014-05-31  9:30   ` William Henney
  0 siblings, 0 replies; 3+ messages in thread
From: William Henney @ 2014-05-31  9:30 UTC (permalink / raw)
  To: Bastien; +Cc: Arun Persaud, emacs-orgmode

Hi Bastien 

Thanks for the suggestion.  I'm traveling at the moment, but I'll check it out as soon as I get a chance.  

Will

Sent from a leading brand of mobile device

> On 30/05/2014, at 16:44, Bastien <bzg@gnu.org> wrote:
> 
> Hi William,
> 
> William Henney <whenney@gmail.com> writes:
> 
>> There is an apparent bug when using the ID property to refer to cells
>> in remote tables, which is currently the only way to refer to a table
>> in an external file.
> 
> One way to deal with this is to set
> 
> (setq org-table-use-standard-references nil)
> 
> Since the default value for the variable is not nil, we could also
> consider preventing the conversion in remote(...) formulas.
> 
> What do you think?
> 
> -- 
> Bastien

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

end of thread, other threads:[~2014-05-31  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  4:24 BUG in reference by ID to remote table (was Re: org babel question: reference tables in remote file) William Henney
2014-05-30 13:44 ` Bastien
2014-05-31  9:30   ` William Henney

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).