From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Gauland Subject: Listings and dialects Date: Tue, 17 Dec 2019 11:35:44 +1300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000aa8e460599d9d506" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:47796) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1igyy5-0007j8-NR for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 17:35:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1igyy4-000563-Jt for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 17:35:57 -0500 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:38683) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1igyy4-00053c-EC for emacs-orgmode@gnu.org; Mon, 16 Dec 2019 17:35:56 -0500 Received: by mail-il1-x135.google.com with SMTP id f5so6761882ilq.5 for ; Mon, 16 Dec 2019 14:35:56 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode --000000000000aa8e460599d9d506 Content-Type: text/plain; charset="UTF-8" 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 --000000000000aa8e460599d9d506 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
My org files typically include source blocks from sev= eral different languages.

I'm using the listin= gs package for export to LaTeX. I'd like to give each language a distin= ctive look (by changing the background or border colour). I can do this man= ually by inserting a bit of LaTeX before each block, but I'd like to av= oid 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 la= nguage. I *can*, however, create a dialect of the language, with a differen= t appearance. If the language has a named dialect I can use as a basis (suc= h as awk, which has gnu and posix dialects), I can then set the default dia= lect to my new dialect, and awk blocks are formatted as I like.
<= br>
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, list= ings 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.

<= div>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 :export= s).

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

Thanks for any assistance,
Mike
--000000000000aa8e460599d9d506--