Currently, this uses the presence of a temporary file to signal that
Matlab Emacs Link evaluation is not yet complete.
Emacs Link support added in collaboration with Christopher Long.
To use EmacsLink, the user will need to set
org-babel-matlab-with-emacs-link to a non-nil value, and also arrange
that (matlab-with-emacs-link) evaluates to a non-nil value.
org-babel-expand-body:lang function needs to be implemented by every
language, and is used to expand the body of a code block for
execution or tangling
adding a suite of functions to org-babel.el which can be used to
handle hlines, rownames, and columnnames in input tables. These
functions can be called from any org-babel-language.el file.
done in close collaboration with Dan Davison
Prior to this, a terminal hline would leave dangling empty cells:
#+TBLNAME: A
|---+---+---|
| a | b | c |
|---+---+---|
#+begin_src emacs-lisp :var tab=A
tab
#+end_src
#+results:
|---+---+---|
| a | b | c |
|---+---+---|
| | | |
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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 |
This change provides for better export of named source-code blocks,
with specific support for more attractive html export. The arguments
are included with the source code name, and both the source code name
and code body are wrapped in a div to support styling with css. For
example the following CSS can be used to associate a source-code block
name with it's code body, and to slightly indent the body.
.org-src-container {
border-left: 4px solid gray;
padding: 0.5em 0.5em 0.5em 1em; }
.org-src-container pre {
margin-left: 1em; }