summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2011-01-13 12:53:28 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2011-01-13 12:53:28 +0100
commit0ec831d2c898a1cf65787efaf212330a1ccf2b17 (patch)
treeb10042f96500e9b9142affeef0b9a312fe3eaed5
parente599234d5c0245dfc53037a6dc0128349b197627 (diff)
parentf7a752f6d60e1c747dc9330c5f12631bf77f6aa3 (diff)
downloadorg-mode-0ec831d2c898a1cf65787efaf212330a1ccf2b17.tar.gz
Merge branch 'master' of orgmode.org:org-mode
-rw-r--r--doc/org.texi34
-rw-r--r--lisp/ob-ref.el2
-rw-r--r--testing/lisp/test-org-table.el56
3 files changed, 89 insertions, 3 deletions
diff --git a/doc/org.texi b/doc/org.texi
index e7bf078..4d696ae 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11380,12 +11380,32 @@ blocks located in the current Org-mode buffer or in the ``Library of Babel''
@item <name>
The name of the code block to be evaluated.
@item <arguments>
-Arguments specified in this section will be passed to the code block.
+Arguments specified in this section will be passed to the code block. These
+arguments should relate to @code{:var} header arguments in the called code
+block expressed using standard function call syntax. For example if the
+original code block named @code{double} has the header argument @code{:var
+n=2}, then the call line passing the number four to that block would be
+written as @code{#+call: double(n=2)}.
@item <header arguments>
Header arguments can be placed after the function invocation. See
@ref{Header arguments} for more information on header arguments.
@end table
+All header arguments placed in the @code{<header arguments>} section
+described above will be applied to the evaluation of the @code{#+call:} line,
+however it is sometimes desirable to specify header arguments to be passed to
+the code block being evaluated.
+
+This is possible through the use of the following optional extended syntax.
+
+@example
+#+call: <name>[<block header arguments>](<arguments>) <header arguments>
+@end example
+
+Any header argument placed between the square brackets in the @code{<block
+header arguments>} section will be applied to the evaluation of the named
+code block. For more examples of passing header arguments to @code{#+call:}
+lines see @ref{Header arguments in function calls}.
@node Library of Babel, Languages, Evaluating code blocks, Working With Source Code
@section Library of Babel
@@ -11644,12 +11664,22 @@ Multi-line header arguments on a named code block:
@subsubheading Header arguments in function calls
At the most specific level, header arguments for ``Library of Babel'' or
-function call lines can be set as shown below:
+function call lines can be set as shown in the two examples below. For more
+information on the structure of @code{#+call:} lines see @ref{Evaluating code
+blocks}.
+The following will apply the @code{:exports results} header argument to the
+evaluation of the @code{#+call:} line.
@example
#+call: factorial(n=5) :exports results
@end example
+The following will apply the @code{:session special} header argument to the
+evaluation of the @code{factorial} code block.
+@example
+#+call: factorial[:session special](n=5)
+@end example
+
@node Specific header arguments, , Using header arguments, Header arguments
@subsection Specific header arguments
The following header arguments are defined:
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index 7995341..f11fcf4 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -76,7 +76,7 @@ the variable."
(cons (intern var)
(let ((out (org-babel-read ref)))
(if (equal out ref)
- (if (string-match "^\".+\"$" ref)
+ (if (string-match "^\".*\"$" ref)
(read ref)
(org-babel-ref-resolve ref))
out))))))
diff --git a/testing/lisp/test-org-table.el b/testing/lisp/test-org-table.el
new file mode 100644
index 0000000..e2501b3
--- /dev/null
+++ b/testing/lisp/test-org-table.el
@@ -0,0 +1,56 @@
+;;; test-org-table.el
+
+;; Copyright (c) ߛ David Maus
+;; Authors: David Maus
+
+;; Released under the GNU General Public License version 3
+;; see: http://www.gnu.org/licenses/gpl-3.0.html
+
+;;;; Comments:
+
+;; Template test file for Org-mode tests
+
+
+;;; Code:
+(let ((load-path (cons (expand-file-name
+ ".." (file-name-directory
+ (or load-file-name buffer-file-name)))
+ load-path)))
+ (require 'org-test)
+ (require 'org-test-ob-consts))
+
+
+;;; Tests
+(ert-deftest test-org-table/org-table-convert-refs-to-an/1 ()
+ "Simple reference @1$1."
+ (should
+ (string= "A1" (org-table-convert-refs-to-an "@1$1"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-an/2 ()
+ "Self reference @1$1."
+ (should
+ (string= "A1 = $0" (org-table-convert-refs-to-an "@1$1 = $0"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-an/3 ()
+ "Remote reference."
+ (should
+ (string= "C& = remote(FOO, @@#B&)" (org-table-convert-refs-to-an "$3 = remote(FOO, @@#$2)"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/1 ()
+ "Simple reference @1$1."
+ (should
+ (string= "@1$1" (org-table-convert-refs-to-rc "A1"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/2 ()
+ "Self reference $0."
+ (should
+ (string= "@1$1 = $0" (org-table-convert-refs-to-rc "A1 = $0"))))
+
+(ert-deftest test-org-table/org-table-convert-refs-to-rc/3 ()
+ "Remote reference."
+ (should
+ (string= "$3 = remote(FOO, @@#$2)" (org-table-convert-refs-to-rc "C& = remote(FOO, @@#B&)"))))
+
+(provide 'test-org-table)
+
+;;; test-org-table.el ends here