emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] org-id: implement arbitrary cross-file references


From: Ihor Radchenko
Subject: Re: [PATCH] org-id: implement arbitrary cross-file references
Date: Mon, 29 May 2023 08:52:03 +0000

Sergei Kosyrev <kosejin@proton.me> writes:

> Fair enough -- I'm open to sign the FSF copyright assignment.

Thanks for your interest to contribute to Org mode!
See https://orgmode.org/worg/org-contribute.html#copyright for the
details how to get started with FSF copyright assignment.

FSF generally replies within 5 working days. If not, let us know.

> +#+BEGIN_src org
> +#+TBLFM: $2='(identity remote(file:./org-wile-with-tables.org,@@#$Value))
> +#+END_src

Would it not be more reasonable to allow generic file links here? Like
in 4.4 External Links section of the manual:

             ‘file:projects.org’
             ‘file:projects.org::some words’ (text search)(1)
             ‘file:projects.org::*task title’ (headline search)
             ‘file:projects.org::#custom-id’ (headline search)

> +(defun org-id-parse-remote-table-ref (refstr)
> +  (save-match-data
> +    (when-let* ((match (string-match "^file:\\([^:]+\\)\\(\\|:.+\\)$" 
> refstr))
> +                (m1 (match-string 1 refstr))
> +                (m2 (match-string 2 refstr))
> +                (filename (cl-remove-if (lambda (c) (member c '(40 41)))
> +                                        (org-table-formula-substitute-names 
> m1)))
> +                (table-name (org-table-formula-substitute-names m2)))
> +      (list filename table-name))))

The format of file:... has nothing at all to do with org-id.el library.
You should instead modify how org-table.el parses remote references
instead of abusing ID resolution mechanisms.

> +                             (let* ((ident (cl-subseq table-id 1))
> +                                    (id-match (search-forward (concat 
> "#+NAME: " ident) nil t)))
> +                               (unless id-match
> +                                 (error "org-id-find-remote: file \"%s\" has 
> no table with NAME \"%s\"." file ident))

Be aware that not all the things with #+NAME in Org files are tables.
You can use `org-element-at-point' to check element type you are looking at.

> -       org-table-column-names org-table-column-name-regexp
> +          org-table-column-names (org-table-column-name-regexp 
> org-table-column-name-regexp)

I fail to see the reason behind this change. May you explain why you had
to protect the global value here?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]