My org files typically include source blocks from several different
languages.

I'm using the listings package for export to LaTeX. I'd like to give each
language a distinctive look (by changing the background or border colour).
I can do this manually by inserting a bit of LaTeX before each block, but
I'd like to avoid having to do that.

As far as I can tell, I can't easily tell the listings package to change
just one aspect of one language. I *can*, however, create a dialect of the
language, with a different appearance. If the language has a named dialect
I can use as a basis (such as awk, which has gnu and posix dialects), I can
then set the default dialect to my new dialect, and awk blocks are
formatted as I like.

Unfortunately, most of the languages I use (bash, sqlite, R), don't have a
name dialect. When I define a new dialect in terms of the default, unnamed
dialect, then set the default dialect to my version, listings throws a
wobbly.

My idea to work around this is to specify a dialect to the source block,
and, if that is present, have org include it in the language is passes to
listings.

So far, though, I haven't been able to puzzle out how to do this. I could
see it being done as a new switch to the code block (similiar to -n to
control line numbering), or as an argument to the block (such as :exports).

Which way would be most 'org-like'?  Any pointers on where to start  poking
around in the code?

Thanks for any assistance,
Mike

Reply via email to