Commit graph

39 commits

Author SHA1 Message Date
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
Dan Davison 210f85ce49 org-babel: store noweb-expanded code body in 'info' data structure 2009-11-09 09:32:00 -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 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 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
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 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
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 68a1240db8 org-babel: ensure that result is returned when using :results output
One half of this patch is a revert of c167a4ac32.

These changes are necessary so that :results output works correctly
with #+lob calls. For example the following example did not work:

--------------------------------------------------
3. :results output org -> doesn't work with #+lob:
--------------------------------------------------
\#+srcname: randthree(n,max)
\#+begin_src ruby
number = n
maximum = max
puts "* Random numbers\n" +
"Here are some random numbers: " +
(1..number).collect {|x| (rand * maximum).ceil }.join(", ") +
"."
\#+end_src

\#+lob: randthree(n=3,max=10) :results output org
2009-10-20 09:24:15 -04:00
Dan Davison 6c0c2039dd org-babel: make [:file filename] imply [:exports results]
Unless :exports is already none or both. This allows users to export
file output simply by adding a [:file filename] header arg.
2009-10-19 23:32:22 -04:00
Dan Davison 351f52192d org-babel: extend the way header args are taken from properties
This change allows org-file-properties to supply header args, and also
allows property inheritance if it has been enabled. Header-args
aquired from the item (or by inheritance) have precedence over those
aquired from org-file-properties.
2009-10-19 21:45:01 -04:00
Eric Schulte 4d374b27d2 org-babel: :noweb header argument now expands noweb references before source-block evaluation 2009-10-19 12:12:19 -06:00
Eric Schulte 3db817fb02 org-babel: now supports pp results (emacs-lisp, ruby, python) 2009-10-18 16:18:34 -06:00
Eric Schulte 4abe8f7ea0 org-babel: added "table" results header argument as more readable alias for "vector" 2009-10-18 12:13:42 -06:00
Eric Schulte 430a3bf6ad org-babel: "code" results type for returning results in of source code syntax
This includes the required changes to org-babel.el and a
language-specific implementation for emacs-lisp.  The emacs-lisp
changes are from a patch by Benny Andresen.
2009-10-16 17:04:55 -06:00
Dan Davison e079584e56 org-babel: make tangling honour org-src-preserve-indentation
This allows python code to be tangled (i.e. extracted) correctly by
org-babel-tangle. Previously, if e.g. methods of a class were in
separate blocks, then they would be incorrectly indented as top-level
functions in the tangled output.
2009-10-08 12:29:37 -04:00
Eric Schulte 27df66d8da org-babel: added :session to the header-arguments allowed in headline properties 2009-10-07 12:46:23 -06:00
Dan Davison fe5c0d96c6 org-babel: tightening up insertion of results
Previously, altering the name of a source block, followed by C-c C-c,
did not alter the name of the corresponding results.
2009-09-30 07:19:15 -06:00
Dan Davison ab7a58aaff org-babel: change regexp parsing of #+srcname line
One thing that was going wrong was that if #+srcname: was provided
with no subsequent name, the name was taken from the next line.
2009-09-30 07:19:14 -06:00
Dan Davison 10ea3ad10b org-babel: make :file header arg imply :results file 2009-09-28 18:55:41 -06:00
Dan Davison 7c32bc5672 org-babel: allow header args to be specified on #+lob line 2009-09-28 18:55:39 -06:00
Eric Schulte 3f1be49a04 adding org-babel-load-in-session-maybe bound to Meta-Up (currently only for Haskell) 2009-09-24 21:58:49 -06:00
Eric Schulte 4cb3e3704e org-babel: cleaned up code that inserts results 2009-09-22 19:49:49 -06:00
Eric Schulte 63b0f3878e org-babel is better at evaluating indented code blocks 2009-09-16 19:33:10 -06:00
Eric Schulte 6ce74742b8 org-babel-execute:gnuplot no longer pops up a gnuplot window
also some whitespace-only indentation changes in org-babel.el
2009-09-14 20:22:56 -06:00
Eric Schulte c0554c7753 merging with the org-babel repository 2009-09-11 13:44:05 -06:00