Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 14 years ago
parent
commit
4c2ad5f87c
7 changed files with 123 additions and 15 deletions
  1. 53 4
      doc/org.texi
  2. 1 1
      lisp/ob-ref.el
  3. 6 5
      lisp/ob.el
  4. 2 2
      lisp/org-docbook.el
  5. 4 2
      lisp/org-html.el
  6. 1 1
      lisp/org.el
  7. 56 0
      testing/lisp/test-org-table.el

+ 53 - 4
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:
@@ -12379,7 +12409,8 @@ execution of a code block regardless of the value of the
 
 The way in which results are handled depends on whether a session is invoked,
 as well as on whether @code{:results value} or @code{:results output} is
-used. The following table shows the possibilities:
+used. The following table shows the table possibilities.  For a full listing
+of the possible results header arguments see @ref{results}.
 
 @multitable @columnfractions 0.26 0.33 0.41
 @item @tab @b{Non-session} @tab @b{Session}
@@ -13423,7 +13454,7 @@ to have other replacement keys, look at the variable
 
 @item @file{yasnippet.el}
 @cindex @file{yasnippet.el}
-The way Org-mode binds the TAB key (binding to @code{[tab]} instead of
+The way Org mode binds the TAB key (binding to @code{[tab]} instead of
 @code{"\t"}) overrules YASnippet's access to this key.  The following code
 fixed this problem:
 
@@ -13434,6 +13465,24 @@ fixed this problem:
             (define-key yas/keymap [tab] 'yas/next-field-group)))
 @end lisp
 
+The latest version of yasnippets doesn't play well with Org mode. If the
+above code does not fix the conflict, start by defining the following
+function:
+@lisp
+(defun yas/org-very-safe-expand ()
+       (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
+@end lisp
+
+Then, tell Org mode what to do with the new function:
+@lisp
+(add-hook 'org-mode-hook
+          (lambda ()
+              (make-variable-buffer-local 'yas/trigger-key)
+              (setq yas/trigger-key [tab])
+              (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
+              (define-key yas/keymap [tab] 'yas/next-field)))
+@end lisp
+
 @item @file{windmove.el} by Hovav Shacham
 @cindex @file{windmove.el}
 This package also uses the @kbd{S-<cursor>} keys, so everything written

+ 1 - 1
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))))))

+ 6 - 5
lisp/ob.el

@@ -592,10 +592,11 @@ results already exist."
 	(if (looking-at org-bracket-link-regexp)
 	    ;; file results
 	    (org-open-at-point)
-	  (pop-to-buffer (get-buffer-create "*Org-Babel Results*"))
-	  (delete-region (point-min) (point-max))
-	  (insert (org-babel-format-result (org-babel-read-result)
-					   (cdr (assoc :sep (nth 2 info))))))
+	  (let ((r (org-babel-format-result
+		    (org-babel-read-result) (cdr (assoc :sep (nth 2 info))))))
+	    (pop-to-buffer (get-buffer-create "*Org-Babel Results*"))
+	    (delete-region (point-min) (point-max))
+	    (insert r)))
 	t))))
 
 ;;;###autoload
@@ -1129,7 +1130,7 @@ org-babel-named-src-block-regexp."
     (when file (find-file file)) (goto-char (point-min))
     (let (names)
       (while (re-search-forward org-babel-src-name-w-name-regexp nil t)
-	(setq names (cons (org-babel-clean-text-properties (match-string 3))
+	(setq names (cons (org-babel-clean-text-properties (match-string 4))
 			  names)))
       names)))
 

+ 2 - 2
lisp/org-docbook.el

@@ -1367,7 +1367,7 @@ TABLE is a string containing the HTML code generated by
 				     (match-string 1 table)
 				     (match-string 4 table)
 				     "</table>")
-			     nil nil table)
+			     nil t table)
 	    table))
     ;; Change <table> into <informaltable> if caption does not exist.
     (if (string-match
@@ -1377,7 +1377,7 @@ TABLE is a string containing the HTML code generated by
 			       (match-string 1 table-with-label)
 			       (match-string 3 table-with-label)
 			       "</informaltable>")
-		       nil nil table-with-label)
+		       nil t table-with-label)
       table-with-label)))
 
 ;; Note: This function is very similar to

+ 4 - 2
lisp/org-html.el

@@ -499,8 +499,10 @@ a file."
 
 (defcustom org-export-htmlize-output-type 'inline-css
   "Output type to be used by htmlize when formatting code snippets.
-We use as default  `inline-css', in order to make the resulting
-HTML self-containing.
+Choices are `css', to export the CSS selectors only, or `inline-css', to
+export the CSS attribute values inline in the HTML.  We use as default
+`inline-css', in order to make the resulting HTML self-containing.
+
 However, this will fail when using Emacs in batch mode for export, because
 then no rich font definitions are in place.  It will also not be good if
 people with different Emacs setup contribute HTML files to a website,

+ 1 - 1
lisp/org.el

@@ -7744,7 +7744,7 @@ WITH-CASE, the sorting considers case as well."
     (looking-at "\\(\\*+\\)")
     (setq stars (match-string 1)
 	  re (concat "^" (regexp-quote stars) " +")
-	  re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[^*]")
+	  re2 (concat "^" (regexp-quote (substring stars 0 -1)) "[ \t\n]")
 	  txt (buffer-substring beg end))
     (if (not (equal (substring txt -1) "\n")) (setq txt (concat txt "\n")))
     (if (and (not (equal stars "*")) (string-match re2 txt))

+ 56 - 0
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