Confirmed, this is indeed strange behaviour, I think a bug. It happens because Org supports both letter/number references to cells (like A7, or in your case r1) and also Org's default representation, something like @7$1 (equivalent to A7) or @1$18 (equivalent to r1). Wherever appropriate, it converts A7-like references to @7$1-like references. See more in
(info "(org) References") , and specifically the "Named references" section. You can evaluate that info sexp, or find it in section 3.5.1 otherwise :). It seems like a mistake to convert such a cell reference in the '$PROP_x' case. The conversion is done by 'org-table-convert-refs-to-rc', which is done before 'org-table-formula-substitute-names' is called. Simply changing the order will not work, since the property value might also be a letter/number-like reference. My added patch fixes this by not replacing such a representation when it is preceded by '$PROP_'. I have two questions about it: - The function '$PROP_<remote' still gives '#ERROR', is this related to this bug, or is the property name '<remote' invalid in any way and is this intended? - Should I add tests for this behaviour? Best, Rens
>From b1b57f263853d28777f4067e782d5cf401e73691 Mon Sep 17 00:00:00 2001 From: Rens Oliemans <ha...@rensoliemans.nl> Date: Fri, 6 Sep 2024 11:36:57 +0200 Subject: [PATCH] lisp/org-table.el: Don't convert table references for properties * lisp/org-table.el (org-table-convert-refs-to-rc): don't convert refs to rc for properties Reported-by: Eric S Fraga <e.fr...@ucl.ac.uk> Link: https://list.orgmode.org/87jzfqjsyr....@ucl.ac.uk --- lisp/org-table.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index a0708e3ec..b1c5f8fbc 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -3451,7 +3451,7 @@ See menu for more commands."))))) Works for single references, but also for entire formulas and even the full TBLFM line." (let ((start 0)) - (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,)]*)\\)" s start) + (while (string-match "\\(\\$PROP_\\)\\{0\\}\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,)]*)\\)" s start) (cond ((match-end 3) ;; format match, just advance -- 2.46.0