emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Noisy and unreliable (de-)tangling
@ 2024-10-21 21:04 Rudolf Adamkovič
  2024-10-22 15:49 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-10-21 21:04 UTC (permalink / raw)
  To: emacs-orgmode

Howdy!

So, I started (de-)tangling heavily, to get some "IDE" support, and
oh-my, what a buggy mess it is.  Not only are tangling comments
super-noisy, the `org-babel-detangle' function is *unreliable*.  If
multiple sections have the same title, such as "Implementation", it
leads to *data loss*.

I think we should rethink this functionality with *readability* and
*reliability* in mind.  The best solution, perhaps, would be to use IDs
for `:comments yes' if `org-id-link-to-org-use-id' is set.  Otherwise,
require `#+NAME', or some other reliable mechanism.  For example:

# >>> TANGLE: <id>
...
# <<< TANGLE: <id>

(Python '#' comments shown above.)

What do you think?

Also ... anyone with some spare time on their hands? :)

P.S. As a cherry on top, it would be also nice to have a minor mode that
highlights tangling comments, jumps back to the relevant Org heading,
etc.

Rudy
-- 
"The introduction of suitable abstractions is our only mental aid to
organize and master complexity."  --- Edsger Wybe Dijkstra, 1930-2002

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-10-21 21:04 Noisy and unreliable (de-)tangling Rudolf Adamkovič
@ 2024-10-22 15:49 ` Ihor Radchenko
  2024-10-28 22:18   ` Rudolf Adamkovič
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2024-10-22 15:49 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

Rudolf Adamkovič <rudolf@adamkovic.org> writes:

> So, I started (de-)tangling heavily, to get some "IDE" support, and
> oh-my, what a buggy mess it is.  Not only are tangling comments
> super-noisy, the `org-babel-detangle' function is *unreliable*.  If
> multiple sections have the same title, such as "Implementation", it
> leads to *data loss*.

> I think we should rethink this functionality with *readability* and
> *reliability* in mind.  The best solution, perhaps, would be to use IDs
> for `:comments yes' if `org-id-link-to-org-use-id' is set.  Otherwise,

`org-id-link-to-org-use-id' should be respected once you use :comments link

> Also ... anyone with some spare time on their hands? :)

Usually, it is the person most annoyed by the lack of feature ;)

> P.S. As a cherry on top, it would be also nice to have a minor mode that
> highlights tangling comments, jumps back to the relevant Org heading,
> etc.

Maybe. But I'd prefer the more fundamental problems to be solved first.
See
https://list.orgmode.org/orgmode/20211017021707.Horde.p9ib-mMooANjOrUuCbc5EPl@www.vfemail.net/
https://list.orgmode.org/orgmode/87h6poqq75.fsf@localhost/
https://list.orgmode.org/orgmode/87bk8gk15d.fsf@ucl.ac.uk/

Here is a potential idea on how to make detangling more robust:
https://leo-editor.github.io/leo-editor/appendices.html#the-mulder-ream-update-algorithm

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-10-22 15:49 ` Ihor Radchenko
@ 2024-10-28 22:18   ` Rudolf Adamkovič
  2024-10-29 19:09     ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-10-28 22:18 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> `org-id-link-to-org-use-id' should be respected once you use :comments
> link

As of now?  It is not.

With `emacs -Q',

    # -*- org-id-link-to-org-use-id: t -*-
    
    * Foo
    :PROPERTIES:
    :ID: B340C425-D772-4147-8B1A-9E4FE700B5C8
    :END:
    
    #+BEGIN_SRC python :tangle test.py :comments link
    print("hi")
    #+END_SRC

tangles as

    # [[file:test.org::*Foo][Foo:1]]
    print("hi")
    # Foo:1 ends here

> Usually, it is the person most annoyed by the lack of feature ;)

Yeah, I will probably roll my sleeves on this, sooner or later, as it is
by far the *simplest* way to make "jump to definition" and other IDE
features work in the Org mode out of the box.

>> P.S. As a cherry on top, it would be also nice [...]
>
> [...] more fundamental problems to be solved first.  See [...]

I said nothing. :)

Rudy
-- 
"If you're thinking without writing, you only think you're thinking."
--- Leslie Lamport

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-10-28 22:18   ` Rudolf Adamkovič
@ 2024-10-29 19:09     ` Ihor Radchenko
  2024-12-15 14:56       ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2024-10-29 19:09 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

Rudolf Adamkovič <rudolf@adamkovic.org> writes:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> `org-id-link-to-org-use-id' should be respected once you use :comments
>> link
>
> As of now?  It is not.
>
> With `emacs -Q',
> ...

Confirmed.
This is likely a regression after we moved id: link handling into
`org-store-link-functions'. Because the code let-binds it to nil, id:
links are never created.

Probably, that cl-letf should be removed now. Or id: store function
should be kept there. I will need to look closer.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-10-29 19:09     ` Ihor Radchenko
@ 2024-12-15 14:56       ` Ihor Radchenko
  2024-12-20 20:43         ` Rudolf Adamkovič
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2024-12-15 14:56 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Rudolf Adamkovič <rudolf@adamkovic.org> writes:
>
>> Ihor Radchenko <yantar92@posteo.net> writes:
>>
>>> `org-id-link-to-org-use-id' should be respected once you use :comments
>>> link
>>
>> As of now?  It is not.
>>
>> With `emacs -Q',
>> ...
>
> Confirmed.
> This is likely a regression after we moved id: link handling into
> `org-store-link-functions'. Because the code let-binds it to nil, id:
> links are never created.
>
> Probably, that cl-letf should be removed now. Or id: store function
> should be kept there. I will need to look closer.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f6a0f151b1

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-12-15 14:56       ` Ihor Radchenko
@ 2024-12-20 20:43         ` Rudolf Adamkovič
  2024-12-23 17:14           ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Rudolf Adamkovič @ 2024-12-20 20:43 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f6a0f151b1

Fixed in -3 lines of code.  Great job!

And it works!  Thank you.

BTW, I am not sure if this is a known bug, but

 `org-babel-detangle' ignores the comment customizations,

namely

  - org-babel-tangle-comment-format-beg and
  - org-babel-tangle-comment-format-end.

As a result, the function, more likely than not,

  detangles nothing,

if the user customized the above.

Rudy
-- 
"It is no paradox to say that in our most theoretical moods we may be
nearest to our most practical applications."
--- Alfred North Whitehead, 1861-1947

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
http://adamkovic.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Noisy and unreliable (de-)tangling
  2024-12-20 20:43         ` Rudolf Adamkovič
@ 2024-12-23 17:14           ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2024-12-23 17:14 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: emacs-orgmode

Rudolf Adamkovič <rudolf@adamkovic.org> writes:

> BTW, I am not sure if this is a known bug, but
>
>  `org-babel-detangle' ignores the comment customizations,
>
> namely
>
>   - org-babel-tangle-comment-format-beg and
>   - org-babel-tangle-comment-format-end.
>
> As a result, the function, more likely than not,
>
>   detangles nothing,
>
> if the user customized the above.

Confirmed.
Although detangling has larger problems.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-23 17:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 21:04 Noisy and unreliable (de-)tangling Rudolf Adamkovič
2024-10-22 15:49 ` Ihor Radchenko
2024-10-28 22:18   ` Rudolf Adamkovič
2024-10-29 19:09     ` Ihor Radchenko
2024-12-15 14:56       ` Ihor Radchenko
2024-12-20 20:43         ` Rudolf Adamkovič
2024-12-23 17:14           ` Ihor Radchenko

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