emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Charles Berry <ccberry@ucsd.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Adding export option for babel language
Date: Thu, 08 May 2014 15:53:21 -0400	[thread overview]
Message-ID: <m2bnv8gi8e.fsf@gmail.com> (raw)
In-Reply-To: <loom.20140508T180556-884@post.gmane.org>

Hi Chuck,

On 2014-05-08 at 12:17, Charles Berry <ccberry@ucsd.edu> 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.

  reply	other threads:[~2014-05-08 19:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08  2:46 Adding export option for babel language Ken Mankoff
2014-05-08 16:17 ` Charles Berry
2014-05-08 19:53   ` Ken Mankoff [this message]
2014-05-08 20:09     ` Ken Mankoff

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=m2bnv8gi8e.fsf@gmail.com \
    --to=mankoff@gmail.com \
    --cc=ccberry@ucsd.edu \
    --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).