5

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.

Kevin Wright
  • 2,397
  • 22
  • 29

3 Answers3

2

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.

Matti Pastell
  • 9,135
  • 3
  • 37
  • 44
0

One option would be mmm-mode, with which you can define regions that are in a different mode -- it also applies a face to the entire sub-mode region, which you can use to easily distinguish those regions within the parent file.

I personally use this for Ruby within IRB, Javascript and CSS within HTML etc. There's an example for javascript in my emacs config.

sanityinc
  • 15,002
  • 2
  • 49
  • 43
0

The MuMaMo extensions allows different rules for different parts of the file. Getting the nXhtml package will give you the mode and I think you can configure it to do what you want.

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169