emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Listings and dialects
@ 2019-12-16 22:35 Michael Gauland
  0 siblings, 0 replies; only message in thread
From: Michael Gauland @ 2019-12-16 22:35 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1717 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-16 22:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-16 22:35 Listings and dialects Michael Gauland

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).