From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: Adding export option for babel language Date: Thu, 08 May 2014 15:53:21 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiUNk-00058k-Rr for emacs-orgmode@gnu.org; Thu, 08 May 2014 15:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiUNf-0005OW-VX for emacs-orgmode@gnu.org; Thu, 08 May 2014 15:53:28 -0400 Received: from mail-qg0-x229.google.com ([2607:f8b0:400d:c04::229]:49349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiUNf-0005OO-RO for emacs-orgmode@gnu.org; Thu, 08 May 2014 15:53:23 -0400 Received: by mail-qg0-f41.google.com with SMTP id j5so3424567qga.14 for ; Thu, 08 May 2014 12:53:23 -0700 (PDT) In-reply-to: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Charles Berry Cc: emacs-orgmode@gnu.org Hi Chuck, On 2014-05-08 at 12:17, Charles Berry wrote: >> I'd like the python code blocks to behave just as they do now, but if I >> have set (setq org-latex-listings 'pythontex) instead of (setq >> org-latex-listings 'minted), then instead of wrapping python code blocks >> with: >> >> \begin{minted}[]{python} >> x+2 >> print x >> \end{minted} >> >> It should wrap them with >> >> \begin{pyconsole} >> x+2 >> print x >> \end{pyconsole} >> > > A quick-and-dirty approach to do just that much would be to write an export > filter for `src-block' and maybe `inline-src-block', see > > (info "(org) Advanced configuration") > > http://orgmode.org/worg/dev/org-export-reference.html#filter-system > > and > > http://orgmode.org/worg/exporters/filter-markup.html > > > Also, `C-h f org--filter TAB' should give you a buffer of such filter > functions (and a couple of false positives) that you might browse. I've briefly looked at the filters. Yes, it seems like that might be one way to do this. But I have a hunch it is already implemented, and that I just don't know how to access it or what variable to set. See: http://orgmode.org/cgit.cgi/org-mode.git/tree/lisp/ox-latex.el#n2280 Where Case 1 is no fontification, Case 3 is minted, and Case 2 is custom. I can see that if `custom-env` is set correctly, it wraps the code exactly as I want above: (custom-env (format "\\begin{%s}\n%s\\end{%s}\n" custom-env (org-export-format-code-default src-block info) custom-env)) But I'm not sure where to set custom-env, although I know I want to set it to `pyconsole`. -k.