emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Sergei Kosyrev <kosejin@proton.me>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-id: implement arbitrary cross-file references
Date: Mon, 29 May 2023 08:52:03 +0000	[thread overview]
Message-ID: <87353fwmdo.fsf@localhost> (raw)
In-Reply-To: <tMZtldCSKDb6DImZOB74rM4a3KZrD9-Cf9_Kyq-z23MzoCub_pGdZowlkfN4RO0xzwPgDOS6t7gRpqfDiufb9UyiKdqB_5ybsWekjRHmJZE=@proton.me>

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	other threads:[~2023-05-29  8:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 12:29 [PATCH] org-id: implement arbitrary cross-file references Sergei Kosyrev
2023-05-27 12:51 ` Sergei Kosyrev
2023-05-27 13:51   ` Ruijie Yu via General discussions about Org-mode.
2023-05-27 15:19     ` Sergei Kosyrev
2023-05-29  8:52       ` Ihor Radchenko [this message]
2023-07-02 10:58         ` Ihor Radchenko
2023-07-02 13:51           ` Sergei Kosyrev
2023-07-02 15:39             ` Ihor Radchenko
2023-10-02 13:36               ` Ihor Radchenko
2024-04-07  9:52                 ` 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=87353fwmdo.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=kosejin@proton.me \
    /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).