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

> I’ve fixed all the issues you mentioned regarding the
> org-babel-tangle--concat-targets function.
> Please find the updated version attached.

Thanks!

Unless I miss something, you forgot to fix the issue with duplicates in
tangle targets and tangle directories.

> As for your suggestion:
>>>The easiest solution is thus getting rid of the
>>>`org-babel-tangle-use-relative-file-links' branch in
>>>`org-babel-tangle--unbracketed-link'.
>>>Instead, we can handle `org-babel-tangle-use-relative-file-links' in
>>>`org-babel-tangle-single-block' itself, post-processing the link there.
>>>Then, we can, say, store the processed link in PARAMS as
>>>:ob-tangle--link when calling `org-babel-expand-noweb-references' and
>>>make `org-babel-tangle-comment-links' check for :ob-tangle--link
>>>parameter instead of calling `org-babel-tangle--unbracketed-link' to
>>>generate the link.
>
> I tried to implement this approach, but it seems quite easy to break
> other parts of Org in the process. Would you mind guiding me on how to
> implement it properly?

Let me try to formulate the simplest possible approach I can think of:

1. In org-babel-tangle--unbracketed-link, instead of looking for :tangle
   parameter, look for :org-babel-current-tangle-target parameter.
2. In org-babel-tangle-single-block, compute
   (file-names (org-babel-tangle--concat-targets file info)) early
3. In org-babel-tangle-single-block, instead of computing BODY and
   RESULT once, do it in the loop, like
   (dolist (file-name file-names)
     (setq params (plist-put params :org-babel-current-tangle-target file-name))
     (setq link (org-babel-tangle--unbracketed-link params)) ; will use 
FILE-NAME
     (setq body ...)
     ;; will use FILE-NAME when calling
     ;; org-babel-expand-noweb-references -> org-babel-tangle--unbracketed-link
   )
4. For each loop iteration, build separate RESULT list -> RESULTS
5. Return (if only-this-block results (car results))

Hope it is more clear.

-- 
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