emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: two sets of default header arguments for one language
Date: Thu, 10 Sep 2015 15:39:19 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1509101533070.955@charles-berrys-macbook.local> (raw)
In-Reply-To: <alpine.OSX.2.20.1509101515320.924@charles-berrys-macbook.local>

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


One more thing ...

On Thu, 10 Sep 2015, Charles C. Berry wrote:

> On Thu, 10 Sep 2015, Alan Schmitt wrote:
>
>> Hello,
>> 
>> I’m writing some lab exercises where I have a fairly long list of header
>> arguments for each source block. I know I can use language-specific
>> default arguments, but I need to switch between questions (short list):
>> 
>> #+begin_src ocaml :tangle tp1.ml
>> 
>> and answers
>> 
>> #+begin_src ocaml :exports results :results verbatim drawer :post 
>> wrap-myres(text=*this*) :tangle tp1_ans.ml
>> 
>> Is there a way to have two sets of default arguments for a given
>> language, or can I declare a new language just for the sake of different
>> arguments?
>> 
>
> I'd use two new `languages'.
>
> For most uses, I think you can get away with as little as this:
>
> (defalias 'org-babel-execute:ocaml-a 'org-babel-execute:ocaml)
> (defalias 'org-babel-execute:ocaml-q 'org-babel-execute:ocaml)
>
> (defvar org-babel-default-header-args:ocaml-a
> 	'((:exports . "results") [fill in the rest] ))
> (defvar org-babel-default-header-args:ocaml-q
> 	'((:tangle . "tp1.ml")))
>
>
> and have acceptable behavior without stepping on the original language.


You also want to customize `org-src-lang-modes' to be able to edit the src 
code natively.

>
> Untested, of course.
>
> HTH,
>
> Chuck

Charles C. Berry                 Dept of Family Medicine & Public Health
cberry at ucsd edu               UC San Diego / La Jolla, CA 92093-0901
http://famprevmed.ucsd.edu/faculty/cberry/

  reply	other threads:[~2015-09-10 22:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 13:54 two sets of default header arguments for one language Alan Schmitt
2015-09-10 21:00 ` Thomas S. Dye
2015-09-11  9:30   ` Alan Schmitt
2015-09-10 21:16 ` Rainer M Krug
2015-09-10 21:25   ` Nicolas Goaziou
2015-09-11  7:09     ` Rainer M Krug
2015-09-11  9:33       ` Alan Schmitt
2015-09-11 16:27       ` Nicolas Goaziou
2015-09-18 10:17         ` Rainer M Krug
2015-09-10 22:28 ` Charles C. Berry
2015-09-10 22:39   ` Charles C. Berry [this message]
2015-09-11  9:36     ` Alan Schmitt
2015-09-14 14:39       ` Alan Schmitt

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=alpine.OSX.2.20.1509101533070.955@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=alan.schmitt@polytechnique.org \
    --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).