Commit Graph

330 Commits

Author SHA1 Message Date
Dan Davison 36351d26a9 Merge branch 'master' of git://repo.or.cz/org-mode 2010-03-27 16:18:27 -04:00
Dan Davison 47571965d4 babel: don't process emacs-lisp params twice 2010-03-27 15:59:53 -04:00
Eric Schulte 8ecc86d49e babel: better variable initialization for org-babel-c 2010-03-27 08:20:38 -06:00
Eric Schulte fc28dd538b babel: shorter language names no longer shadow larger names
Previously "R" could overshadow "Ruby", and "C" could overshadow
  "Clojure", causing blocks of the longer language name to fail to
  load. This issue has now been fixed
2010-03-26 20:54:16 -06:00
Eric Schulte 22e4cd9b6d babel: org-babel-c more robust, better error messages and c++ support 2010-03-26 19:35:31 -06:00
Eric Schulte b61019489c babel: org-babel-C now displays compilation error messages 2010-03-26 17:12:43 -06:00
Eric Schulte e3fbc98b26 babel: removed errant reference to R from org-babel.el 2010-03-26 16:28:25 -06:00
Eric Schulte 17790c7dad babel: limited initial support for C and similar languages 2010-03-26 16:28:23 -06:00
Eric Schulte f400632f94 babel: when passing values from a table an extra '$' prefix forces literal
thanks to Maurizio Vitale for the suggestion.  This allows literal
  values to be passed to code blocks through `sbe' without forcing the
  use of quotes inside the table.
2010-03-25 11:09:38 -06:00
Eric Schulte 727aa263cb babel: src block regexps are more robust to embedded "[begin|end]_src" in block body 2010-03-22 15:19:33 -06:00
Eric Schulte 32bbd3f3bb babel: variable references which look like lisp forms are now evaluated
for example, the following simple example
    #+begin_src emacs-lisp :var two=(+ 1 1)
      (sqrt two)
    #+end_src

    #+results:
    : 1.4142135623730951

  Or this more interesting usage, which pulls variable values from
  headline properties
    *** example headline w/property
        :PROPERTIES:
        :special:  89
        :last-name: schulte
        :END:

    #+begin_src emacs-lisp :var special=(string-to-number (org-entry-get nil "special" t))
      (+ special 1)
    #+end_src

    #+results:
    : 90

    #+begin_src emacs-lisp :var last-name=(org-entry-get nil "last-name" t))
      (message "hello %s" last-name)
    #+end_src

    #+results:
    : hello schulte
2010-03-22 15:19:32 -06:00
Dan Davison abf0a50d1b babel: Ensure that inline code blocks produce string output on export 2010-03-19 10:08:16 -04:00
Dan Davison adb2f3f590 babel: Add octave and matlab support 2010-03-18 14:45:39 -04:00
Dan Davison aa0e4b86ce babel: Fix org-babel-load-file
This was broken by 29a2ab0047
2010-03-18 14:30:54 -04:00
Dan Davison 73d8e57685 babel: Allow tramp syntax when supplying :tangle filename
Patch by Rémi Vanicat.
2010-03-17 21:03:21 -04:00
Dan Davison 29a2ab0047 babel: when tangling do not add extension if filename supplied 2010-03-17 20:09:06 -04:00
Dan Davison 6976d9fc79 babel: org-babel-switch-to-session [C-c M-b z]
org-babel-pop-to-session is an alias of this
2010-03-16 12:57:28 -04:00
Dan Davison 485781ed40 babel: set default-directory in org-babel-pop-to-session 2010-03-13 14:02:47 -05:00
Dan Davison f4ae431706 babel: Make code block params available when initiating session 2010-03-13 14:02:31 -05:00
Dan Davison 215d11c092 babel: New hook org-babel-after-execute-hook
Runs at the end of org-babel-execute-src-block
2010-03-13 14:02:22 -05:00
Dan Davison ba4d698fa1 babel: Provide notification of errors during code execution
This deals with external process :results value mode for R, ruby,
python, perl and clojure: if the shell process has a non-zero exit
code, a buffer containing stderr is displayed.
2010-03-05 11:32:18 +00:00
Dan Davison 4e9a2d4efd babel: Fix bug in shell-command-on-region
Prior to this commit,

OUTPUT-BUFFER nil
REPLACE 'replace
ERROR-BUFFER 'current-buffer

resulted in stdout going with stderr to the current buffer, contra the
docstring. With this change stdout is discarded in this case. The
docstring does stipulate that stdout always should go to *Shell
Command Output*; this change does not make that happen in this case.
2010-03-05 11:32:11 +00:00
Dan Davison 05986e95ea babel: Introduce org-babel copy of shell-command-on-region
At this commit, org-babel-shell-command-on-region is a direct copy of
shell-command-on-region. In addition to switching to use the org-babel
version, we change the argument passed so that they agree with the
docstring of s-c-o-r.

Despite the change in arguments, the same behaviour results because
s-c-o-r does not behave as documented in emacs23. Future commits will
be able to fix these bugs in the org-babel version, as necessary.
2010-03-05 11:32:04 +00:00
Dan Davison ed7b8bfcca babel: clojure: read results remotely when necessary 2010-03-03 22:00:08 +00:00
Dan Davison 54c7b04734 babel: clojure: use shell-command-on-region 2010-03-03 21:59:32 +00:00
Dan Davison a8c1a49b77 babel: Read perl results remotely when necessary. 2010-03-03 16:11:04 +00:00
Dan Davison 9c36b20a25 babel: make output file links track changed directory 2010-03-02 14:51:01 +00:00
Dan Davison 486bc2fe64 babel: Use file-name-as-directory to form default-directory 2010-03-02 14:51:01 +00:00
Eric Schulte f0f511916a babel: org-babel-oz.el now uses unix-style newline characters 2010-03-01 08:31:05 -07:00
Dan Davison 44c8487e2d babel: fix bug with remote working directory
This change fixes a bug in the remote execution branch, involving the
way that org-babel-tramp-handle-call-process-region is used
to (conditionally) handle calls to call-process-region. When
org-babel-execute-src-block called itself recursively (e.g. when
resolving a reference to another src block), a circular binding of
symbols and values resulted.
2010-02-27 18:19:18 -05:00
Dan Davison 322fe431c5 babel: Write R input data remotely when necessary. 2010-02-27 18:19:09 -05:00
Eric Schulte a705bf5925 babel: wrapped `org-babel-make-remote-file-name' in conditional as `org-babel-maybe-remote-file' 2010-02-27 18:18:37 -05:00
Dan Davison 24cdeea122 babel: read remote results from remote files
When using ':results value' in certain situations, results are written
to file by the foreign language process and subsequently read from
file by emacs into an elisp table structure. If the foreign language
process is running remotely, then the results are written
remotely. These changes ensure that in that case, an appropriate
remote file name is constructed to read the remote data.
2010-02-27 14:14:08 -05:00
Dan Davison 2056d7d419 babel: Allow shell-command-on-region to execute remotely
These changes solve two problems: both are discussed in the following thread

http://lists.gnu.org/archive/html/tramp-devel/2010-02/msg00025.html

of which a summary follows.

Firstly, shell-command-on-region does not work with tramp in the same
way that shell-command does. I.e. whereas

(let ((default-directory "/user@remote-host:"))
  (shell-command "hostname" t))

gives the remote hostname,

(let ((default-directory "/user@remote-host:"))
  (shell-command-on-region (point) (mark) "hostname" t))

does not.

The reason is that shell-command-on-region calls call-process-region,
which does not use a tramp handler for remote files. However, such a
file handler does exist (unused) in the tramp sources:
tramp-handle-call-process-region. There is a slight problem in that
there is a bug in that function definition in current tramp (which has
persisted because the function is not normally used).

Therefore, we define an org-babel version of
tramp-handle-call-process-region which fixes the bug, and we bind
call-process-region to org-babel-tramp-handle-call-process-region for
the duration of org-babel-execute-src-block.
2010-02-27 14:14:08 -05:00
Dan Davison b3d5a1eb39 babel: working directories and remote execution
This introduces a new header argument :dir. For the duration of source
block execution, default-directory is set to the value of this header
argument. Consequences include:

- external interpreter processes run in that directory
- new session processes run in that directory (but existing ones are unaffected)
- relative paths for file output are relative to that directory

The name of a directory on a remote machine may be specified with
tramp syntax (/user@host:path), in which case the interpreter
executable will be sought in tramp-remote-path, and if found will
execute on the remote machine in the specified remote directory.
2010-02-27 14:14:08 -05:00
Dan Davison 5f8a57ad48 babel: change implementation of external R process evaluation
Use shell-command-on-region, bringing R into line with ruby, python,
clojure, shell. In addition to consistency (and perhaps efficiency),
this will also be preferable in the case of a remote R process because
it means that transfer of the input to the remote process is dealt
with automatically by tramp.
2010-02-27 14:14:08 -05:00
Eric Schulte 522f30bc9f babel: tiny doc tweak 2010-02-27 14:14:07 -05:00
Dan Davison cc7052540b babel: allow point to move to end of comint buffer 2010-02-27 14:14:07 -05:00
Dan Davison 283ebcb43b babel: New const variable org-babel-header-arg-names
This is used when checking for babel header args in org properties.
2010-02-27 14:14:07 -05:00
Dan Davison 82d7585810 babel: Tighten result and source line regexps
Anchored to beginning of line, with optional whitespace indenting.
2010-02-25 17:58:46 -05:00
Dan Davison 5833fbd358 babel: Make colnames header arg expect use "yes" for true. 2010-02-25 17:58:46 -05:00
Dan Davison 4064c31fa7 babel: get rid of unused variable 2010-02-25 17:58:46 -05:00
Dan Davison fc693eb5e2 babel: treat python tuples as lists 2010-02-25 17:58:45 -05:00
Dan Davison a95c05773e babel: Fix unquoting of strings
Before this change we have

 #+begin_src ruby :results value :session
 ["1", "3"]
 #+end_src

 #+results:
 : 1", "3

 After, we have

 #+begin_src ruby :results value :session
 ["1", "3"]
 #+end_src

 #+results:
 | 1 | 3 |
2010-02-25 17:58:45 -05:00
Dan Davison 6f62066ac6 babel: Fix export bug.
Introduced at 747f425f00
2010-02-25 15:12:47 -05:00
Dan Davison eb521ae95e Remove org-R from contrib
org-babel should be used to execute R code from org-mode.
2010-02-24 12:42:48 -05:00
Eric Schulte 8625e5c0bc babel: gnuplot can now return it's string output -- when session is set to "none" 2010-02-23 08:16:25 -07:00
Dan Davison a2d94ffc8e babel: prevent quoting of strings in shell variables 2010-02-23 07:31:43 -07:00
Carsten Dominik 6a5f6deaac Fix bug in org-git-link.el.
Patch by David Maus
2010-02-20 20:34:39 +01:00
Eric Schulte 753d1402d8 babel: avoid infinite loop in org-babel-execute-buffer -- Thanks to Stephan Schmitt 2010-02-16 13:34:09 -07:00