From: Rens Oliemans <hallo@rensoliemans.nl>
To: "Fraga, Eric" <e.fraga@ucl.ac.uk>,
Emacs Org mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: strange behaviour with $PROP_r1 value in a table
Date: Fri, 06 Sep 2024 11:40:47 +0200 [thread overview]
Message-ID: <877cbpce74.fsf@rensoliemans.nl> (raw)
In-Reply-To: <87jzfqjsyr.fsf@ucl.ac.uk>
[-- Attachment #1: Type: text/plain, Size: 1183 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-table.el-Don-t-convert-table-references-for.patch --]
[-- Type: text/x-patch, Size: 1138 bytes --]
From b1b57f263853d28777f4067e782d5cf401e73691 Mon Sep 17 00:00:00 2001
From: Rens Oliemans <hallo@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.fraga@ucl.ac.uk>
Link: https://list.orgmode.org/87jzfqjsyr.fsf@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
next prev parent reply other threads:[~2024-09-06 9:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 10:27 strange behaviour with $PROP_r1 value in a table Fraga, Eric
2024-09-06 9:40 ` Rens Oliemans [this message]
2024-09-06 10:12 ` Fraga, Eric
2024-09-07 10:46 ` Ihor Radchenko
2024-09-09 10:13 ` Rens Oliemans
2024-09-10 19:07 ` Ihor Radchenko
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=877cbpce74.fsf@rensoliemans.nl \
--to=hallo@rensoliemans.nl \
--cc=e.fraga@ucl.ac.uk \
--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).