Commit graph

200 commits

Author SHA1 Message Date
Dan Davison 210f85ce49 org-babel: store noweb-expanded code body in 'info' data structure 2009-11-09 09:32:00 -07:00
Carsten Dominik d23b72ec30 Add John Wiegley's org-learn.el to the contrib directory 2009-11-05 08:24:18 +01: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
Carsten Dominik 4523ae580b Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2009-11-02 22:12:51 +01:00
Carsten Dominik cfcc99c789 org-mac-iCal.el: work with calendar "groups"
Doug Hellmann writes:

> Some calendar systems (Google, Zimbra) handle subscriptions to
> multiple calendars (or to an account) by grouping them under a single
> caldav directory in the calendar tree.  org-mac-iCal assumes there is
> only one ics file created per caldav directory, so while it *creates*
> all of the needed merged ics files, it only copies one of them to
> ~/Library/Calendar before importing the contents into the diary.
2009-11-02 22:12:46 +01: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
Eric Schulte 7edbb11a57 Merge branch 'ded-babel' 2009-11-01 14:40:17 -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
Carsten Dominik 7d75d03e40 Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode 2009-11-01 20:14:05 +01:00
Carsten Dominik 274add3c85 Use diary-file variable to point to diary file
Patch by Doug Hellman
2009-11-01 18:20:07 +01: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
Carsten Dominik 848b2039a1 Add org-git-link.el by Raimar Finken 2009-10-28 12:14:41 +01: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
Carsten Dominik bdb6992813 Apply patch to fix registry
Patch by Andreas Burtzlaff
2009-10-22 15:23:58 +02:00
James TD Smith 04ea1a3b14 Some small fixes in org-registry.
org-registry-assoc-all removed matching links from the registry. This meant
subsequent calls with the same parameters would return nothing.

Add another function for finding entries in the register, which used find-if to
get entries satisfying a predicate.
2009-10-21 10:42:50 +02: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
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