
Ask HN: How do you take notes alongside code? - morbidhawk
I&#x27;m reading code from one of the big open source framework and finding it hard to organize notes alongside the code. I haven&#x27;t found a good way to take notes alongside the code I&#x27;m reading so I can later come back and review it.<p>My preferred way of doing it in the past has been printing out the code and writing notes alongside it in the margins but I&#x27;ve stopped doing that as it keeps wasting a lot of printer paper and ink.<p>I&#x27;m curious if anybody else has taken notes alongside code and how they are doing it, because I feel like there isn&#x27;t a good way of doing it that I know of yet.<p>I&#x27;ve also tried using org-mode in Emacs and markdown but found that a lot of editors grey out the code making it harder to see, and the whole point is to see the code since I&#x27;m reading the code and it doesn&#x27;t seem worth the effort to copy the file over to Emacs if it looks hideous. Also, I tried downloading the repository (written in C#) and opening it in Visual Studio in hopes to take notes in the form of code comments and I realized that it requires a lot of work and installations to even get the repo to compile and since I&#x27;m only wanting to read the code and take notes I don&#x27;t want to go to that effort and without getting it to compile VS makes most of the code go red with bothersome error squiggles everywhere.<p>How do you take notes alongside code? Is there a good way out there that tailors to reading code and taking notes?
======
andreareina
I use org mode.

If you `(setq org-src-fontify-natively t)` in your org-mode hook it will
render code blocks with that language's display settings, which helps a lot.

For two side-by-side buffers, left for code right for notes:

* left: `M-x clone-indirect-buffer`

* either: `M-x scroll-all-mode`

* right: `M-x fixme-mode`[1]

The idea is that you abuse the highlighting of FIXME/TODO comments (in the
right buffer only) and put your notes there. Scrolling is synced so both
buffers are always looking at the same view. It's a bit of a kludge but has
the advantage over org-mode that it's easier to add the notes.

EDIT: If you cared enough about it you could write a simple major mode for the
right pane that highlights all comments[2] so you don't need the FIXME prefix.
As a bonus you could also grey out the actual code.

[1]
[https://www.emacswiki.org/emacs/FixmeMode](https://www.emacswiki.org/emacs/FixmeMode)

[2]
[http://ergoemacs.org/emacs/elisp_comment_coloring.html](http://ergoemacs.org/emacs/elisp_comment_coloring.html)

~~~
morbidhawk
This looks like a very feasible approach, I didn't realize you could lock
scrolling for side-by-side buffers. That's really awesome. I'll have to give
this a try

