Commit Graph

91 Commits

Author SHA1 Message Date
Eric Schulte 0fa68a53ba org-babel: language specific files using cleaner parameter passing 2009-11-10 15:23:18 -07:00
Eric Schulte 082fb84c34 org-babel: cleaner passing of parameter to language specific files 2009-11-10 15:23:00 -07:00
Eric Schulte 28881fa29d org-babel: added `org-babel-noweb-error-langs' to raise errors when noweb references can't be resolved 2009-11-10 08:59:17 -07:00
Eric Schulte 97e21c5b09 org-babel-clojure: one list tiny fix 2009-11-09 22:44:13 -07:00
Eric Schulte 103e0c4bf5 org-babel-clojure: minor bug fixes 2009-11-09 22:24:06 -07:00
Joel Boehland 78a3c5d57b org-babel-clojure: Added clojure language support to org-babel 2009-11-09 22:23:38 -07:00
Dan Davison bf3281692f org-babel-tangle: Save buffer at outset. 2009-11-09 09:32:05 -07:00
Dan Davison bec4551d8b org-babel: Add support for perl
Session-based evaluation is not supported.
2009-11-09 09:32:04 -07:00
Dan Davison 3ec02a953d org-babel-python: Silent bug fix.
The code worked because the unintended extra parentheses didn't cause problems.
2009-11-09 09:32:02 -07:00
Dan Davison 6875d4d8e3 org-babel: file output for ruby and python
With this change, if :file <filepath> is specified, ruby and python
blindly output a link to <filepath>. Responsibility for creating the
contents in <filepath> lies with the python/ruby code.
2009-11-09 09:32:01 -07:00
Dan Davison 210f85ce49 org-babel: store noweb-expanded code body in 'info' data structure 2009-11-09 09:32:00 -07:00
Eric Schulte e3bf0b4a81 org-babel-haskell: org-babel-haskell-export-to-lhs now optionally preserves indentation
based either on the value of org-src-preserve-indentation or the
    presence of the -i switch
2009-11-04 17:46:55 -07:00
Eric Schulte 260007e61f org-babel-tangle: now careful to only add one shebang per file 2009-11-04 15:18:50 -07:00
Eric Schulte cd405fad22 org-babel-tangle: now conservative about whitespace insertion around tangled blocks 2009-11-04 15:14:45 -07:00
Dan Davison 43bd90ef81 org-babel: new header argument :results_switches
If present this should be followed by org-mode block switches to be
inserted with the results block.
2009-11-04 14:55:10 -07:00
Dan Davison ea2cd9b1c8 org-babel: make info structure available when removing/inserting results
This also eliminates two extra calls to org-babel-get-src-block-info.
2009-11-04 14:55:09 -07:00
Dan Davison f01fb927e1 org-babel: read results contained in generic org blocks 2009-11-02 06:50:28 -07:00
Dan Davison 13d670744e org-babel: set case-fold-search t when reading results 2009-11-02 06:50:26 -07:00
Dan Davison 43cd1aa2b9 org-babel: trim trailing newline from noweb-referenced material 2009-11-01 14:39:17 -05:00
Dan Davison 8b33a47410 org-babel: match multiple noweb references on same line correctly. 2009-11-01 14:38:17 -05:00
Dan Davison 3cf02c1afa org-babel: allow regexp to be supplied in org-babel-trim, as per docstring. 2009-11-01 14:36:47 -05:00
Dan Davison c84903f1b3 org-babel: export of functional-style source blocks
A "functional-style" source block is one in which the name is followed
immediately by a parenthesised argument. An example is the following
"function", which generates n uniform random numbers:

\#+srcname: rand(n)
\#+begin_src R
runif(n)
\#+end_src

With these changes, such source blocks are passed over to the export
machinery in the following form:

\#+begin_src org-babel-lob
<function-def-keyword> rand(n):
\#+end_src
\#+begin_src R <switches>
<indent>runif(n)
\#+end_src

where <function-def-keyword> is the value of
org-babel-function-def-export-keyword, which defaults to "function",
<switches> are the src block switches that belonged to the original
block, and <indent> is the whitespace indent of the function body, the
width of which is determined by org-babel-function-def-export-indent.
org-babel-lob is a simple major mode responsible for fontification of
the blocks corresponding to the function definition line (as opposed
to the function body).
2009-11-01 10:05:42 -05:00
Dan Davison 75299025d6 org-babel: use org-babel-get-src-block-info during export 2009-11-01 10:05:42 -05:00
Dan Davison 872d9157d9 org-babel: include functional-style args in org-babel-get-src-block-info list
This adds a new terminal (sixth) element to the list returned from
org-babel-get-src-block-info. It is used when exporting the code of
"functional style" code blocks, i.e. those in which the name of the
block is followed by a parenthesised argument list (or an empty pair
of parentheses).
2009-11-01 10:05:42 -05:00
Dan Davison d97f767632 org-babel: avoid inserting blank line at bottom of exported code blocks 2009-11-01 10:05:42 -05:00
Dan Davison 64cd40700e org-babel: Reinstate switches when exporting blocks of code 2009-11-01 10:05:42 -05:00
Dan Davison a0d03014ab org-babel: internal change: defer breaking up of info list in org-babel-exp.el 2009-11-01 10:05:42 -05:00
Dan Davison 72691f1ff7 org-babel: Single function to return all source block info.
- org-babel-get-src-block-info returns the name of the block as a new
  fifth element.

- org-babel-get-src-block-info incorporates the parenthesised variable
  references into the header arg list, with precendence given to
  explicit :var references, as before.

- remove function org-babel-get-src-block-name

- remove function org-babel-get-src-block-function-args

org-babel-get-src-block-function-args now returns a list
  (lang body params-alist switches srcname)
where, unless a non-nil value for the optional argument is passed,
params-alist contains any :var entries acquired from the parenthesised
argument list following the srcname.
2009-11-01 10:05:42 -05:00
Dan Davison dcc669f20a org-babel: parse src block switches
The switches are flags like -n and must *precede* the first colon
after the language (i.e. precede the first header argument). So the
general src block syntax is
\#+begin_src lang <switches> :header1 val1 :header2 val2 ...
...

org-babel-get-src-block-info now returns a list
(lang body params-alist switches)
2009-11-01 10:05:41 -05:00
Dan Davison c7d3844bd9 org-babel: annotate org-babel-src-block-regexp with comments for clarity 2009-11-01 10:05:41 -05:00
Dan Davison c6fb5d94d0 org-babel: update authorship records 2009-11-01 10:05:41 -05:00
Dan Davison 7cea83d870 org-babel-exp: ensure presence of `org-current-export-file' before resolving foreign file references 2009-10-29 09:00:50 -06:00
Eric Schulte e01839a826 org-babel-latex: initial support for exporting latex from org-babel 2009-10-28 16:13:53 -06:00
Eric Schulte f4d5b6dd49 org-babel noweb reference evaluation
noweb references which include ()s are now evaluated.  It is
  possible to pass arguments to the noweb references using the existing
  lob argument syntax.  So after this commit the following

<<example-block>>

  will insert the body of "example-block", and the following

<<example-block()>>

  will insert the results of "example-block", and the following

<<example-block(a=9)>>

  will insert the results of "example-block" with argument "a" set to
  the literal value of 9
2009-10-28 16:13:33 -06:00
Dan Davison 962a1e0608 org-babel: fix inline source block regexp
This satisfies the requirements that
1. the src_lang{} construct is preceded by whitespace
2. this whitespace is not consumed by the replacement text
2009-10-26 21:51:43 -06:00
Dan Davison 512b376bb5 org-babel: allow multiple spaces/tabs between "src" and lang 2009-10-26 21:51:42 -06:00
Dan Davison 2f82ee771a org-babel: use %s to format inline result when it is a string.
This avoids returning quote characters with the string.
2009-10-26 21:51:41 -06:00
Dan Davison 3fa8c7dfff org-babel: enforce canonical (lang body params) order of arguments 2009-10-26 21:51:39 -06:00
Eric Schulte 1771e61cfc org-babel-exp: simplification of org-babel-lob-mode 2009-10-25 12:52:17 -06:00
Eric Schulte 6851f07f92 org-babel-exp: adding org-babel-lob-mode for fontification of lob lines 2009-10-25 10:47:12 -06:00
Dan Davison 70a5963563 org-babel: avoid false positive matches for inline and #+lob constructs
This forces the #+lob regexp to match at the beginning of a line (with
optional preceding whitespace), and requires inline code blocks to be
surrounded by some whitespace.
2009-10-25 10:47:07 -06:00
Dan Davison 5f1ea1ce70 org-babel: By default, don't use session for inline blocks 2009-10-25 10:47:06 -06:00
Dan Davison ed0f4a36e9 org-babel: Export code and/or results of #+lob function calls.
Currently, python fontification is used for export of these lines, due
to some similarity between python function call syntax and #+lob call
syntax. This is implemented as a language type "babel", mapped to
python in org-src-lang-modes.
2009-10-24 15:27:43 -06:00
Eric Schulte 824c8c0dba org-babel: behaviour-neutral changes anticipating subsequent work on export
merging original change by Dan Davison which generalizes the types
  of blocks exported by org-babel to include the following types
  - inline
  - lob
  - block
2009-10-23 16:02:29 -06:00
Eric Schulte 6ef0dd44bd org-babel-exp: exporting inline src blocks now respects different :results type 2009-10-23 16:02:28 -06:00
Eric Schulte 4539c8998c org-babel-exp when exporting blocks, don't return results as string
rather execute normally using org-babel-insert-results to insert the
  results in the buffer
2009-10-23 16:02:27 -06:00
Eric Schulte 62c8d0a835 org-babel: foreign-file references work, export is fully functional
1) source blocks can now reference source-blocks in other files using
   the filename:sourcename syntax

2) on export all references are now made to explicitly point to the
   original buffer using the filename:sourcename syntax.  This ensures
   that all references are correctly resolved on export, even when the
   referenced source block has already been processed.
2009-10-23 16:02:24 -06:00
Eric Schulte 540fa74513 org-babel-exp.el is now working for inline blocks 2009-10-23 16:02:23 -06:00
Dan Davison c168c6ccaa org-babel: improve prompt when choosing file to tangle 2009-10-20 10:17:42 -04:00
Dan Davison 32cfddf7b1 org-babel: fix #+lob line regexp 2009-10-20 09:48:03 -04:00