Commit graph

312 commits

Author SHA1 Message Date
Dan Davison f53d61980f Fix argument parsing bug. 2009-07-23 22:55:29 -04:00
Dan Davison c2bef96b7f Fix parser bug. 2009-07-23 22:32:03 -04:00
Dan Davison fadb5d5093 Change looking-at-p to looking-at.
Patch from Stephan Schmitt.
2009-07-23 11:06:44 -04:00
Eric Schulte 6b5747fdfa Revert "DONE take default values for header args from properties"
This is breaking many of our tests, so I'm reverting it until I can figure out a fix

This reverts commit 9936814ffc.
2009-07-22 19:02:12 -06:00
Eric Schulte 9936814ffc DONE take default values for header args from properties 2009-07-22 18:59:10 -06:00
Eric Schulte 51cfe9e468 DONE add =:tangle= family of header arguments
these can be used to inhibit tangling
2009-07-22 18:30:30 -06:00
Eric Schulte 4f15568a96 org-babel-ded-worg looks great, I hope you don't mind I'm adding a
"Reference / Documentation" section to hold documentation on the many
header arguments
2009-07-22 17:17:06 -06:00
Eric Schulte 34cf22bdaa DONE Fix nested evaluation
and commenting out debugging statements
2009-07-22 16:05:13 -06:00
Eric Schulte 66faa937f8 DONE deeply nested arguments still fails
added a function `org-babel-ref-split-args' for splitting arguments
  into top-level balanced expressions
2009-07-22 16:04:19 -06:00
Eric Schulte fe0532e509 DONE One supplied, one default
We are now skipping results lines when resolving references which
  specify arguments, as the arguments would change the value of the
  source-code block.
2009-07-21 16:46:26 -06:00
Eric Schulte 2bfa420c6a DONE empty parens () not recognised as lob call 2009-07-21 16:27:48 -06:00
Eric Schulte 53c08df3ae so it looks like regardless of the syntax used we're not overriding
the default argument values.
2009-07-21 12:22:59 -06:00
Eric Schulte 85dc35656d DONE gnuplot sessions 2009-07-20 13:33:53 -06:00
Eric Schulte e5b2e307fa removed the result-params from the let in org-babel-gnuplot,
keeping the vars line in the let for now because of the peculiar
  handling of the vars in gnuplot.
2009-07-20 13:10:11 -06:00
Eric Schulte 809462e3ee Merge branch 'master' into gnuplot
Conflicts:
	lisp/langs/org-babel-gnuplot.el

With respect to the conflict, I will try removing the lines you
mentioned before my next commit.
2009-07-20 13:07:29 -06:00
Eric Schulte c81479b161 added a :file header argument to gnuplot 2009-07-20 13:04:40 -06:00
Eric Schulte 307c7667db still working on gnuplot variable support 2009-07-19 16:40:28 -06:00
Dan Davison b766b094a0 Using temp function definition to tidy R evaluation code. 2009-07-19 18:03:33 -04:00
Eric Schulte 9bdddde454 gnuplot: switching to using user defined variables for handling variables
This will require gnuplot version 4.2 or up
2009-07-19 15:46:05 -06:00
Dan Davison 2b66de1c1b Reorganising R evaluation code.
With this change we avoid messing about extracting the output from the
comint buffer in the :results value case (the value has already been
written to file).
2009-07-19 17:45:00 -04:00
Eric Schulte 01c6bd2b33 pulled the gnuplot variable processing out into it's own function 2009-07-19 15:30:40 -06:00
Eric Schulte 20eec8d94b additional requirements and initialization for gnuplot 2009-07-19 15:01:47 -06:00
Dan Davison 162b522728 Fixing srcname function call regexps.
But still some improvement of this to be done (see bugs section).
2009-07-19 14:29:10 -04:00
Dan Davison aa1747b065 Quite a few revisions / additions to the tasks and bugs lists. 2009-07-19 13:56:38 -04:00
Dan Davison e4d14d41ec This should have been part of the parent commit (911e77a7c9) 2009-07-19 13:55:42 -04:00
Eric Schulte 585f69d1f7 Merge branch 'master' into gnuplot 2009-07-19 11:12:09 -06:00
Eric Schulte 28c3262848 fixed variable name in org-babel-R-evaluate 2009-07-19 11:06:44 -06:00
Eric Schulte 91301b8c29 Merge branch 'master' into gnuplot 2009-07-19 11:02:17 -06:00
Dan Davison 911e77a7c9 Code rearrangement: restrict R column names changes to org-babel-R.el.
On reflection this is (currently) R-specific functionality and should
not affect the code in org-babel.el.
2009-07-19 12:01:00 -04:00
Dan Davison 8294122f8f Trying to retain whitespace in output results from R.
I don't believe this solves it, but chomp is more the right thing to
do than trim. I'd like to retain all the whitespace so that alignment
of columns is correct in stdout.
2009-07-19 01:47:37 -04:00
Dan Davison 062bc09d84 Adding support for column names (header line) when using R.
Unlike the other languages, it's central to R to be able to index
columns of a data frame d, either by d[,"columnname"] of d$columnname.

With this change, if colnames are present in the *input* from
org-babel, the corresponding R variable is *always* constructed with
the colnames.

In addition, with the :colnames header arg, the *output* to elisp/org
buffer contains the colnames separated from the rest of the table by
'hline. This behaviour is not default because other languages may
expect a simple table without the 'hline.
2009-07-19 01:07:07 -04:00
Eric Schulte 4ff540bfd7 started bringing in options from org-plot 2009-07-18 18:05:11 -06:00
Dan Davison ef6668df61 Merging examplizing-output into master 2009-07-18 18:10:14 -04:00
Dan Davison bcfa3b95c7 Add ability to remove #+begin_example blocks of output. 2009-07-18 17:47:30 -04:00
Eric Schulte fcfe110fef correctly handling exclusive :exports params 2009-07-18 14:24:47 -06:00
Eric Schulte 44ff72261c moved org-babel-merge-results into anonymous function in flet 2009-07-18 14:24:46 -06:00
Dan Davison c2b255e0da Changing default min lines for block output to 10 2009-07-18 15:52:51 -04:00
Dan Davison 4dfe45cdf1 Trivial: function name change for clarification. 2009-07-18 15:39:00 -04:00
Dan Davison 04a4a4862e Using #+begin_example...#+end_example blocks for output. 2009-07-18 15:38:21 -04:00
Eric Schulte fdae720848 removed large block of lang-specific comments from org-babel.el
I assume that since all tests are passing we no longer need this old
code.  Either way we can always retrieve it from version control.
2009-07-17 22:10:43 -06:00
Eric Schulte 6661bb70d5 new default export parameters 2009-07-17 22:08:02 -06:00
Eric Schulte bda750be2f combination of :results parameters now takes mutually exclusive parameter groups into consideration 2009-07-17 22:06:37 -06:00
Eric Schulte 8408187f4a using org-babel-merge-params for inline header arguments 2009-07-17 21:36:47 -06:00
Dan Davison 83fc113e29 This was just an idea. We could do it but I'm reverting for now.
Revert "Make org-babel-tangle comment with ;;*."

This reverts commit c6b628d3ad.
2009-07-17 14:51:49 -04:00
Dan Davison 017d46e50f Reinstated force-results-to-vector: passing all tests in table. 2009-07-17 14:37:43 -04:00
Dan Davison 8c9d8b6c28 Don't attempt to remove result when :results silent. 2009-07-17 13:58:04 -04:00
Dan Davison 9ebb554527 o-b-merge-params function was not allowing whitespace around the '=' sign.
At some point it might be useful (to me at least) to clarify our rules
regarding whitespace, and make guidelines for using " \t\f\n\v\r" et
al (and [:space:]?).
2009-07-17 13:27:56 -04:00
Dan Davison 7eecca6db5 Reinstating a previous change that got lost in the last merge somehow. 2009-07-17 10:49:26 -04:00
Dan Davison 72ccd88c97 Merging master into results.
THis brings in the bugfix from 4f15280631, as well as gnuplot. The bugfix required manual resolution as it had already been partially addressed in this branch. Also, the interaction of the possibility of being on a #+lob line and the possiblity of being in the middle of an org-babel-exp-results call, meant I had to rearrange things a bit, so this commit has new changes in org-babel-where-is-src-block-result in addition to the merge.
2009-07-17 09:54:11 -04:00
Dan Davison 5d49db67ab Correcting up cut/paste mistakes made in manual conflict resolution. 2009-07-17 00:50:02 -04:00
Eric Schulte 1fa18830ab gnuplot is able to generate graphs, but needs much more work 2009-07-16 22:20:58 -06:00
Dan Davison 4f15280631 Bugfix: not assuming that we're in a source block when inserting result.
The o-b-insert-result code was assuming that we were in a source
block, where it could find the head, etc. However there are two
situations when this is not true LoB calls (although they can't output
results to buffer in this branch, they can in branch 'results'), and
org-babel-exp (which calls o-b-insert-result in an empty temp buffer).
2009-07-17 00:18:03 -04:00
Dan Davison 64a5c0e379 Merging master into results: required manual conflict resolution.
results had upgraded to using org-babel-merge-params (although
apparently not yet in org-babel-parse-inline-src-block-match).
2009-07-16 23:22:25 -04:00
Eric Schulte cdc46b8b74 added ability for languages to change their default header argument values 2009-07-16 18:52:31 -06:00
Eric Schulte 37d5edbad9 fleshing out the gnuplot task 2009-07-16 18:35:22 -06:00
Eric Schulte 5527d419a1 added support for ditaa source blocks 2009-07-16 18:23:19 -06:00
Eric Schulte 29d910c5e2 "file" results now correctly insert a file link 2009-07-16 18:17:51 -06:00
Eric Schulte b932d2ed76 ditaa evaluation is working (but still requires some more peripheral support) 2009-07-16 18:12:11 -06:00
Dan Davison 4fa9c162d9 More code streamlining: org-babel-execute:emacs-lisp. 2009-07-16 16:23:49 -04:00
Dan Davison d128662fa3 Eliminating duplicated code (take 2...).
This proposal for code tidying uses multiple-value-bind to satisfy:

1. The various parsed/resolved components of the param list (session,
   vars, result-type) are available in the org-babel-execute:LANG
   functions.
2. Those functions don't duplicate the code for parsing the params
   list and resolving references
3. The functions still have the params list available to them, should
   they need to implement language-specific behaviour using it.

If the org-babel-execute:LANG functions need to be called directly,
then that would now have to be via
(multiple-value-bind (session vars result-params result-type)
      (org-babel-process-params params) (funcall cmd body params))

as in org-babel-exp.el. (But is it actually necessary to by-pass
org-babel-execute-src-block?)
2009-07-16 16:21:07 -04:00
Dan Davison f74b084d99 Bringing org-babel-execute-[buffer/subtree] functions up-to-date. 2009-07-16 14:57:01 -04:00
Dan Davison c6b628d3ad Make org-babel-tangle comment with ;;*.
With a view to providing org-style folding with the outline-regexp
settings from Tassilo Horn / Michael Zeller / Sebastain Vauban.
2009-07-16 11:25:57 -04:00
Dan Davison 690ed664c6 Merging master into results.
In order to get new tangle load-file function. Had to resolve org-babel.org conflict manually and didn't know the 'proper' way to do so, so there may be weirdness in that file.
2009-07-16 01:28:15 -04:00
Dan Davison 2b273bce7d Different messages for :results output and value modes. 2009-07-16 01:16:49 -04:00
Eric Schulte f3050c17d6 removed debug statement 2009-07-15 17:52:28 -07:00
Dan Davison ad57e15afe Bugfix in org-babel-read (relevant to all branches).
I haven't managed to see why this is a 2. It breaks if cell is a
string of length 1. I'm changing it to a 1 (as it is in
org-collector.el), on the assumption that the 2 was erroneous.
2009-07-15 11:18:19 -04:00
Eric Schulte d37d148d3f DONE singe-function tangling and loading elisp from literate org-mode file [3/3] 2009-07-14 21:55:50 -07:00
Eric Schulte cdd73500d6 DONE ensure that org-babel-tangle returns the path to the tangled file(s) 2009-07-14 21:52:27 -07:00
Eric Schulte 07c919cb31 fleshing out actual loading of tangled files 2009-07-14 21:52:10 -07:00
Eric Schulte c3166dc093 now able to tangle files by language 2009-07-14 21:52:07 -07:00
Eric Schulte 8694253c9f getting started on automatic loading of elisp from org-mode files 2009-07-14 20:21:08 -07:00
Dan Davison c1f8de5eec Cosmetic changes only: shortening lines to fit my screen. 2009-07-11 23:59:04 -04:00
Dan Davison 08eba0ceea Bugfix: my regexp was not allowing whitespace inside function call. 2009-07-11 23:51:01 -04:00
Dan Davison a0e0fe17f4 A neutral bug (unnecessary, but no consequences I believe). 2009-07-11 23:49:51 -04:00
Dan Davison 21d058869d Bugfix in org-babel-read (relevant to all branches).
I haven't managed to see why this is a 2. It breaks if cell is a
string of length 1. I'm changing it to a 1 (as it is in
org-collector.el), on the assumption that the 2 was erroneous.
2009-07-11 22:45:57 -04:00
Dan Davison cd4c794af6 Bugfix: Use let* instead of let 2009-07-11 13:39:05 -04:00
Dan Davison f622d8d288 Bugfix: In org-babel-merge-params.
Using symbol instead of string so that assq-delete-all works. This
will break if a variable has a name that is not a valid elisp symbol
-- unlikely? Possible? Also, fixing the argument parsing regexp, which
had been very lazily written.
2009-07-11 03:07:37 -04:00
Dan Davison ee749f4d70 Bugfix:
I had made org-babel-get-src-block-name automatically check whether it
was on a lob line. I'm reverting that.
2009-07-11 03:04:41 -04:00
Dan Davison 0a6fa24cc5 bugfix: org-babel-parse-header-arguments was creating nonsense when passed an empty string. 2009-07-11 03:01:54 -04:00
Dan Davison af6af0b848 Tightening up org-babel-lob-one-liner-regexp. 2009-07-10 23:15:16 -04:00
Dan Davison 44adc98505 Enabling LoB to put results in buffer, and slowly moving towards more
unified concept of function calls.

Previously LoB calls were not able to produce results in the
buffer. These changes go some way to allowing them to do that. [There
are still some bugs to deal with]. That meant changing org-babel.el so
that there is a notion of the `source block name' for a LoB line, in
order to construct a #+resname (currently I've made the name the same
as the function call).

I'm also slowly moving towards unifying the notion of `function calls'
a bit more: I've changed the org-babel-lob-one-liner-regexp so that
instead of a monolithic match it now matches first the function name,
and second the function arguments in
parentheses. org-babel-lob-get-info makes that match, and although it
still concatenates them and returns the string, the two elements can
be accessed immediately afterwards using match-string. So that
situation is very similar to org-babel-get-src-block-name, whose
job (in this branch) is also to parse the function *name* and the
function *arguments*. In a few places in the code (esp. function
names), I think the word `info' should be replaced with `call' or
`function call', which I believe more accurately indicates what the
`info' is: a function definition, together with bound
arguments/references.

The function call syntax, i.e. function-name(arg1=ref1), originally
introduced for references (and thereby in LoB), and which I'm
proposing we use throughout, raises the question of default arguments,
and those being over-ridden by supplied arguments, as in e.g. python,
and R.
2009-07-10 22:59:10 -04:00
Dan Davison 42fe3144b7 Some more bugs / TODOs, and some unimportant changes. 2009-07-10 21:13:21 -04:00
Dan Davison eb7206f744 Fixing function call-style source block arguments.
style syntax. There still needs to be work done on the regexps for
recognising #+srcname lines possibly with/without parenthesised
arguments. This change makes org-babel-block-name return nil rather
than fail when it doesn't find a src block head (e.g. in a #+lob
line), which seems sensible.

The sbe test table is failing half-way down at `simple ruby
arrays'. For some reason it is making a mini table ("| |") to the
right hand, and point keeps jumping out of the table. My ability to
debug sbe-related stuff is hampered by me not understanding the
code (I need to learn about macros).
2009-07-10 18:38:12 -04:00
Dan Davison 41381781bb Using function call() style source block arguments.
This is a rough, first-pass implementation using some code from
org-babel-ref.el. If we do go with this idea, I think we can find a
better implementation, hopefully using the same code for parsing
`function calls' (parameterised source block calls), whether they are
made directly at a source block, or as a reference in another function
call, or as a LoB call.
2009-07-10 01:35:15 -04:00
Dan Davison c1b72bfba8 Trivial typo fixing 2009-07-10 01:20:56 -04:00
Dan Davison 2bddc5fdf8 Revert "Moving non-language specific code out of language-specific files."
This reverts commit 0f541a680d.

See commit note for parent commit. Both reversions made for same reason.
2009-07-08 00:13:07 -04:00
Dan Davison 9772adef3e Revert "Altering org-babel-execute:emacs-lisp in accordance with preceding changes."
This reverts commit d8001facab.

Going back to original plan of simply passing (cmd body params) to the org-babel-execute:LANG functions.

The benefit of this is that languages will have access to the full params list. A downside is that code parsing the
params list and referencing variables is currently duplicated across the languages, so perhaps we can aim to reduce
that code duplication at some point.
2009-07-08 00:06:14 -04:00
Dan Davison 5cbc2d3803 Using the new org-babel-merge-params function to combine default args with header args provided. 2009-07-07 23:57:49 -04:00
Dan Davison 7e80d01571 Now we have a function for merging params lists, so in theory this reversion can be reverted.
Revert "Revert "making :results replace the default""

This reverts commit dc702a3152.
2009-07-07 19:48:19 -04:00
Dan Davison 9d79afb3b3 Merge branch 'working-on-combining-params' into results 2009-07-07 19:46:10 -04:00
Dan Davison 5280e5ea4f Attempt at a working version of the org-babel-merge-params function. 2009-07-07 19:44:27 -04:00
Dan Davison d8001facab Altering org-babel-execute:emacs-lisp in accordance with preceding changes. 2009-07-05 23:09:28 -04:00
Dan Davison 0f541a680d Moving non-language specific code out of language-specific files.
Moved reference resolution out of language-specific files; changed
things so that we parse the header args list in org-babel.el, and
changed the argument list of the org-babel-execute:LANG functions
accordingly. In addition to hopefully resulting in easier maintenance,
this results in more streamlined org-babel-execute:LANG functions, and
hence less work to do when adding interpreters.
2009-07-05 22:36:51 -04:00
Dan Davison 6143bb7aad Streamlining/fiddling with org-babel-execute-src-block.
This includes an explicit implementation of the idea that no result is
returned in the case of :results output.
2009-07-05 21:57:42 -04:00
Dan Davison f7ea8ccb2e Added comment to org-babel-process-result explaining
results-processing changes and state they are currently in. Here's the
comment:

  You can see below the various fragments of results-processing
  code that were present in the language-specific files. Out of
  those fragments, I've moved the
  org-babel-python-table-or-results and
  org-babel-import-elisp-from-file functionality into the
  org-babel-*-evaluate functions. I think those should only be
  used in the :results value case, as in the 'output case we are
  not concerned with creating elisp versions of results.

  The rest of the functionality below, concerned with vectorising
  or scalarising results is commented out, has not yet been
  replaced, and may need to be reinstated in this function
2009-07-05 21:37:00 -04:00
Dan Davison dc702a3152 Revert "making :results replace the default"
This reverts commit a13cbf64b6.

I'm in favour of this change, but it seems that we need a more sophisticated way of combining plists before we can
change the default header args in this way. Otherwise, we get two entries for :results (one from the defaults and one
from the header args), whereas what we want is a single entry for :results with space-separated values.
2009-07-05 21:23:47 -04:00
Dan Davison df3b1b7223 Fixing results processing code.
When :results is 'value, the org-babel-LANG-evaluate functions are
responsible for returning an elisp representation of the *value* of
the block. This stage is maintained in the language-specific code
because different languages have different ways of doing it: python
and ruby use org-babel-LANG-table-or-string, whereas R and shell write
to file and then use org-babel-import-elisp-from-file. It could
however be put in the org-babel-execute:LANG function.
2009-07-05 21:23:17 -04:00
Dan Davison 9750226de7 Ruby version of previous commit.
Bug fix: I was missing out org-babel-table-or-string with external
    process evaluation (non-session).

    Also, I have renamed org-babel-ruby-table-or-results to org-babel-ruby-table-or-string.

    (the previous commit's message should have read org-babel-python-table-or-results...)
2009-07-05 19:59:24 -04:00
Dan Davison e45cf15b06 Bug fix: I was missing out org-babel-table-or-string with external
process evaluation (non-session).

Also, I have renamed org-babel-table-or-results to org-babel-table-or-string.
2009-07-05 19:55:54 -04:00
Dan Davison 305c90b892 First stage of results code simplification.
Results processing code has been moved out of language-specific
files (which all contained similar versions of essentially the same
code) and into the central org-babel.el. This commit maintains the
removed language-specific fragments commented out in org-babel.el. It
does not make an attempt to replace their functionality (the new
function org-babel-process-result currently does nothing).

Similarly, I intend to move the reference resolution code out of
language-specific files.
2009-07-05 19:23:32 -04:00