emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Gauland <mikelygee@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Listings and dialects
Date: Tue, 17 Dec 2019 11:35:44 +1300	[thread overview]
Message-ID: <CA+boh8xZY78RDf699LnZUhnpZBfYM_r27kdmFC96godG1XNY-Q@mail.gmail.com> (raw)

[-- 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 --]

                 reply	other threads:[~2019-12-16 22:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+boh8xZY78RDf699LnZUhnpZBfYM_r27kdmFC96godG1XNY-Q@mail.gmail.com \
    --to=mikelygee@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).