Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code chunk fontification in Emacs noweb mode?

Tags:

emacs

noweb

In noweb mode, I would like to make the doc chunks and code chunks easier to distinguish. I'm already using font-lock-mode, but it applies the same face to strings in R and strings in tex, so doesn't distinguish the code and doc chunks very well.

For example, a slightly different background color for the code chunks.

One possibility would be to define a new face for the minor mode of the code chunk, but then that face would also apply when editing a buffer in that mode.

Another possibility would be to create an overlay for the code chunks.

Also, somewhat related, org-mode can be configured to use different background colors for source blocks.

Update: I now use polymode to achive this.

like image 390
Kevin Wright Avatar asked Nov 06 '22 09:11

Kevin Wright


1 Answers

You can use noweb-font-lock-mode from ESS to get syntax highlighting for both code and documentation chunks. I'd recommend you also use noweb-mode from ESS too, because it has some improvements.

like image 192
Matti Pastell Avatar answered Nov 09 '22 05:11

Matti Pastell