mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-07-20 13:56:28 +00:00
TBLFM remote ref: Improve indirection
* lisp/org-table.el (org-table-remote-reference-indirection): Use the optional arg START of `string-match' to improve performance and to avoid endless loop on user error.
This commit is contained in:
parent
bc1d54b84b
commit
9a5b8a7434
|
@ -5017,19 +5017,17 @@ For example \"remote($1, @>$2)\" => \"remote(year_2013, @>$1)\".
|
||||||
This indirection works only with the format @ROW$COLUMN. The
|
This indirection works only with the format @ROW$COLUMN. The
|
||||||
format \"B3\" is not supported because it can not be
|
format \"B3\" is not supported because it can not be
|
||||||
distinguished from a plain table name or ID."
|
distinguished from a plain table name or ID."
|
||||||
(let ((index-last -1) index-this)
|
(let ((start 0))
|
||||||
(while (and (setq index-this
|
(while (string-match (concat
|
||||||
(string-match (concat
|
;; Same as in `org-table-eval-formula'.
|
||||||
;; Same as in `org-table-eval-formula'.
|
"\\<remote([ \t]*\\("
|
||||||
"\\<remote([ \t]*\\("
|
;; Allow "$1", "@<", "$-1", "@<<$1" etc.
|
||||||
;; Allow "$1", "@<", "$-1", "@<<$1" etc.
|
"[@$][^,)]+"
|
||||||
"[@$][^,]+"
|
;; Same as in `org-table-eval-formula'.
|
||||||
;; Same as in `org-table-eval-formula'.
|
"\\)[ \t]*,[ \t]*\\([^\n)]+\\))")
|
||||||
"\\)[ \t]*,[ \t]*\\([^\n)]+\\))")
|
form
|
||||||
form))
|
start)
|
||||||
;; Protect from last replace replaced itself.
|
(setq start (match-end 0))
|
||||||
(/= index-last index-this))
|
|
||||||
(setq index-last index-this)
|
|
||||||
;; Substitute the remote reference with the value found in the
|
;; Substitute the remote reference with the value found in the
|
||||||
;; field.
|
;; field.
|
||||||
(setq form
|
(setq form
|
||||||
|
|
Loading…
Reference in a new issue