Lei Zhe <lzhe...@gmail.com> writes:

> I realized that it's challenging to handle the error properly if the
> return value of org-babel-tangle-single-block remains unchanged.
>
> Consider your code block:
> #+begin_src emacs-lisp :tangle '("1.el" "2.el")
>     (+ 1 2)
> #+end_src
>
> In the org-babel-tangle--unbracketed-link function, if
> org-babel-tangle-use-relative-file-links is non-nil, the expression
> (file-relative-name  "/tmp/test.org::heading" '("1.el" "2.el")) will
> raise the error. That's why I used ignore-errors in the first patch
> within org-babel-tangle-single-block.

`ignore-errors' did not solve the underlying logic problem. It would
simply disable backlinks when tangling to multiple files.

> If I handle this properly using a loop and return a list of relative
> file links, the return value of org-babel-tangle-single-block must
> also be adjusted to a nested list accordingly. Otherwise, it would be
> meaningless and could lead to potential errors.

Why should it?
Similar to what you already do in the patch with only-this-block
argument, you can simply return multiple
 (file-name src-lang start-line file link source-name params body comment)
items.

You just need to return

 (file-name1 ... link1 ...)
 (file-name2 ... link2 ...)

rather than just

 (file-name1 ... link ...)
 (file-name2 ... link ...)

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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