Live data from Hacker News

Ask HN: How do you maintain personal annotations for code you don't control?

news.ycombinator.com

41–45 of 45 posts

Re: Ask HN: How do you maintain personal annotations for code you don't control?

#41
post #28

Earlier quoted context omitted.

I came here to post this. To expand: With Leo editor, you convert the document/file into a tree of nodes (one way to do this is to make each function a node - they have plugins to do it automatically for well known languages like C++). Let's say you make a particular function a node. You can then make a new document in your own filesystem which has your notes, but you can make a "live" copy of the node linking to tha…

> It's the one powerful feature that has yet to be replicated in Emacs. Emacs cannot do this. There are many Emacs libraries or packages that need this feature (Org babel is a big one, transclusion is another), and have to work around its absence in hacky ways.

Not sure why you got downvoted - you are correct.[1]

I don't know if there is any fundamental limitation in Emacs/Elisp that prevents it, or that no one has succeeded in doing it. I suspect it's the latter. I also suspect the problem is trying to shoehorn this to work with Org Mode (which is what I want as well), but there may be a significant impedance mismatch between the Org code base and this feature.

Frankly, trying to manipulate the Org tree using Elisp is a nightmare compared to how simple it is in Leo (using Python). I've been trying to do with Org mode what is fairly basic in Leo: Traverse the tree, make changes, copy the tree to another file, with some headlines demoted/promoted due to rules, etc. Although I finally got something working, it took a lot of research as well as multiple packages. Whereas in Leo, people without a programming background manage to write the Python code to do this very easily.

[1] karthink has written a number of heavily used Emacs packages. He likely knows what he's talking about.

Re: Ask HN: How do you maintain personal annotations for code you don't control?

#44
A lot of times I just take notes in a personal fork, but that's imperfect for all of the obvious reasons.

I also take notes in my notes app. This obviously is imperfect too, but the codebases I work on aren't typically churning so much that these notes become out of date too quickly.

Re: Ask HN: How do you maintain personal annotations for code you don't control?

#45
post #23

> Separate markdown files (hard to maintain precise code references) That shouldn’t be difficult. Most code repository systems support links to exact line numbers in specific commits, for example like [0]. Even in the event that the links stop working, you can still identify the commit hash, file name and line number from the URL. [0] https://github.com/curl/curl/blob/3b057d4b7a7e6b811245fd0312...

This is my approach as well. I write a doc to myself with commit+line links for code, relevant snippets from documentation linked to the source, and annotated screenshots where that makes more sense, also linked if the source is web based.
Post reply on HN