Konstantin Borisov <ir...@ya.ru> writes:

>> Using line numbers is not exactly reliable. What if the source org file
>> changes? The line numbers will not be correct then.
>
> From the theoretical perspective of view you are right. But from the
> practical I think line numbers should work well enough.

I doubt so. It will all boil down to the typical workflow.
If the workflow is mostly working with tangled code and detangling it
into mostly untouched Org file, then line numbers will be ok. But if the
Org file is the main source that is often modified, the line numbers
will basically never work.

> Also we could use line-numbers as fallback. It the block is named then
> it’s ok to use it’s name directly, but when not, line-numbers will work
> better than current implementation with fuzzy line search, all not named
> source blocks looks very similar (especially when move `:noweb-ref'
> header argument to `:header-args:' section property).

What about using the approach we take for `org-id-link-to-org-use-id' -
auto-create unique names when necessary.

> I can see following practical cases when detangle could be useful:
> ...

Detangle is certainly useful. What I want to discuss is rather
implementation details.

>>> …
>>> In comments it have following information:
>>> - where to find the org-file this file was tangled from (`ORG-FILE
>>>   filepath')
>>> - where to find source block with sources (`SRC line-in-org-file' and
>>>   `SRC line-in-org-file ends here') 
>>> - the borders of noweb references (`NOWEB noweb-ref' and `NOWEB
>>>   noweb-ref ends here') 
>>> …
>>> To acheive such result we need to modify the
>>> `org-babel-expand-noweb-reference' function to not just insert the
>>> source blocks links, but also adding the noweb reference begin/end
>>> comments lines to tangled file.
>>> …
>>
>> I believe that the ultimate solution will be using
>> <https://leo-editor.github.io/leo-editor/appendices.html#the-mulder-ream-update-algorithm>
>
> Probably you are right. From the first glance their detangle works, but
> looks like them using some simpler noweb version. And btw them stil
> using `noweb-ref' marks in tangled code even if not using them for detangle.
> Here is how their tangled file looks like.

Then, I do not oppose adding noweb marks.
I am mostly skeptical about line numbers.

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