> I would like to stop using `org-edit-special' for non-trivial tasks and start 
> detangling instead, as the former makes Emacs much less powerful.

Can't agree more!  In fact, this is the main motivation working on this.

> But if the link is a unique ID link, which is the recommended linking method 
> these days, it could "just work", no?

It seems to be some miscommunication here.  You can consult my design/literate 
doc for more details, but I can briefly explain it here:

You are right to be confused, since the link by itself does seem to contain the 
enough information that points back to the source block.  However, such links 
are the links produced by =:comments link= (which is also included when you 
have =:comments noweb=, as it produces a superset of the former).

Here comes a significant difference when you *don't care about* Noweb 
references.  The precise semantics of the links that you thought are sufficient 
is, "the link to the block that has =:tangle xxx=", instead of "the link to the 
source".  Consider the following example in my doc (the result is from the 
current ob-tangle, not my version):

#+name: a string
#+begin_src emacs-lisp
"hello"
#+end_src

#+begin_src emacs-lisp :tangle case-analysis.el :noweb yes :comments noweb
<<a string>>
#+end_src

tangles to:

#+begin_src emacs-lisp
;; [[file:org-babel-detangle.org::*Single references, each on its own 
line][Single references, each on its own line:1]]
;; [[file:org-babel-detangle.org::*Single references, each on its own line][a 
string]]
"hello"
;; a string ends here
;; Single references, each on its own line:1 ends here
#+end_src

Note that both comments have the link being 
"file:org-babel-detangle.org::*Single references, each on its own line", but 
with different source name.  This is why I say that it does not suffice to just 
have the link, since it is ambiguous under the Noweb case, unless I make it a 
special case to see if you don't have Noweb references in your blocks, which I 
personally think might not be a good design.

My version, unfortunately, still conforms to this weird design, since I don't 
want to surprise users with new behaviors - they might be used to just move 
their cursor to the link and run =org-open-at-point= and believe that they will 
be brought to the block with =:tangle=, not the Noweb referred block.

If the community is fine with more aggressive change, I think a more intuitive 
way to do this is definitely to have all links pointing to the correct 
location, and just let =org-babel-jump-to-org= be smarter and find the 
outermost link wrapping the cursor point.

> https://leo-editor.github.io/leo-editor/appendices.html#the-mulder-ream-update-algorithm

Sorry I don't have time to take a closer look, but I don't feel that it is the 
most relevant thing to our needs.  The necessity of such a noisy Noweb comments 
essentially lies in the incredible expressiveness of Noweb tangles and the 
corner cases - especially when using :noweb-ref or having some prefix/suffix on 
the same line as the Noweb reference.  Also the algorithm seems to be very 
dubious on ambiguous cases, which is something I personally *can't compromise 
on*.

My bottomline is a *sound and faithful* detangling that is a *proper inverse* 
of the tangling, which might come at the cost of issues like even more noisier 
comments.

> P.S. It would be also useful to be able to tangle into the attachment 
> directory.  As far as I know, the current tangling mechanism cannot do that.  
> This is unrelated, but worth mentioning if we are rewriting for the future.

Not sure what you mean by "attachment directory".  But you can advice 
=org-babel-get-src-block-info= and manipulate the :tangle header argument as 
you want.  =org-babel-tangle= uses it to know about where it should tangle to.  
Hope this helps.

MT

On Wed, Nov 12, 2025, at 04:47, Rudolf Adamkovič wrote:
> MT <[email protected]> writes:
> 
> > Therefore, the link itself does not suffice the minimal amount of
> > information needed for detangling.
> 
> But if the link is a unique ID link, which is the recommended linking
> method these days, it could "just work", no?
> 
> Context:
> 
> I would like to stop using `org-edit-special' for non-trivial tasks and
> start detangling instead, as the former makes Emacs much less powerful.
> Emacs Lisp cannot navigate to functions, Eglot does not work at all, and
> so on.  Tangle comments, as implemented today, are much too noisy for
> me, let alone others.  Ihor mentioned some clever algorithm that can
> detangle intelligently:
> 
> https://leo-editor.github.io/leo-editor/appendices.html#the-mulder-ream-update-algorithm
> 
> Perhaps that is the way forward?
> 
> P.S. It would be also useful to be able to tangle into the attachment
> directory.  As far as I know, the current tangling mechanism cannot do
> that.  This is unrelated, but worth mentioning if we are rewriting for
> the future.
> 
> Rudy
> -- 
> "It is not the strongest of the species that survives, not the most
> intelligent that survives. It is the one that is the most adaptable to
> change."
> 
> --- Charles Darwin
> 
> Rudolf Adamkovič <[email protected]> [he/him]
> http://adamkovic.org
> 

Reply via email to