> I'm finding that Org would work well as a literate programming system > for C++, if the code block starts and ends didn't get in the way so much > during frequent switching between code and prose. > > > I use the following to make code block syntax less intrusive > > Thanks, that was helpful, didn't know about compose-region. > Still, it does not reduce the number of lines used, so a short list of > declarations interspersed with comments quickly ends up taking a lot of > vertical space. When coding it helps to be able to see many things at > once, and having many extra lines (even mostly-blank ones) makes that > difficult. >
I agree that maximizing code per vertical space is important. However, keeping Org-mode parseable and editable is also important. How about the following alternative to my previous suggestion, which will eliminate the extra lines. (defun prettier-org-code-blocks () (interactive) (font-lock-add-keywords nil '(("\\(^[[:space:]]*#\\+begin_src .*[\r\n]\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) "") nil))) ("\\(^[[:space:]]*#\\+end_src[\r\n]\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) "") nil)))))) Best, > > ilya > > > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D