summaryrefslogtreecommitdiff
path: root/lisp/org/ob.el
diff options
context:
space:
mode:
authorBastien Guerry <bzg@gnu.org>2012-10-26 16:42:05 +0200
committerBastien Guerry <bzg@gnu.org>2012-10-26 16:42:05 +0200
commitbdebdb64b35d6a0a28e04335f4e8e46949206ad3 (patch)
treeea3e0d00bd8da93ae89e86744a80f4e162c5361c /lisp/org/ob.el
parentccc83f50a4ca55842bcf955b9f8156c17aa43864 (diff)
downloademacs-bdebdb64b35d6a0a28e04335f4e8e46949206ad3.tar.gz
emacs-bdebdb64b35d6a0a28e04335f4e8e46949206ad3.tar.bz2
emacs-bdebdb64b35d6a0a28e04335f4e8e46949206ad3.zip
Merge upstream Org (from commit acbbe2)
Diffstat (limited to 'lisp/org/ob.el')
-rw-r--r--lisp/org/ob.el37
1 files changed, 14 insertions, 23 deletions
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index f15457d68e2..b06aac11f69 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -39,7 +39,6 @@
(declare-function show-all "outline" ())
(declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS))
(declare-function org-mark-ring-push "org" (&optional pos buffer))
-(declare-function org-strip-protective-commas "org" (beg end))
(declare-function tramp-compat-make-temp-file "tramp-compat"
(filename &optional dir-flag))
(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault))
@@ -64,7 +63,6 @@
(declare-function org-cycle "org" (&optional arg))
(declare-function org-uniquify "org" (list))
(declare-function org-current-level "org" ())
-(declare-function org-strip-protective-commas "org" (beg end))
(declare-function org-table-import "org-table" (file arg))
(declare-function org-add-hook "org-compat"
(hook function &optional append local))
@@ -87,10 +85,11 @@
(declare-function org-list-struct "org-list" ())
(declare-function org-list-prevs-alist "org-list" (struct))
(declare-function org-list-get-list-end "org-list" (item struct prevs))
-(declare-function org-strip-protective-commas "org" (beg end))
(declare-function org-remove-if "org" (predicate seq))
(declare-function org-completing-read "org" (&rest args))
-(declare-function org-add-protective-commas "org-src" (beg end))
+(declare-function org-escape-code-in-region "org-src" (beg end))
+(declare-function org-unescape-code-in-string "org-src" (s))
+(declare-function org-table-to-lisp "org-table" (&optional txt))
(defgroup org-babel nil
"Code block evaluation and management in `org-mode' documents."
@@ -494,8 +493,8 @@ can not be resolved.")
;;; functions
(defvar call-process-region)
-;;;###autoload
+;;;###autoload
(defun org-babel-execute-src-block (&optional arg info params)
"Execute the current source code block.
Insert the results of execution into the buffer. Source code
@@ -838,6 +837,7 @@ evaluation mechanisms."
(key-binding (or key (read-key-sequence nil))))))
(defvar org-bracket-link-regexp)
+
;;;###autoload
(defun org-babel-open-src-block-result (&optional re-run)
"If `point' is on a src block then open the results of the
@@ -944,6 +944,7 @@ buffer."
(def-edebug-spec org-babel-map-inline-src-blocks (form body))
(defvar org-babel-lob-one-liner-regexp)
+
;;;###autoload
(defmacro org-babel-map-call-lines (file &rest body)
"Evaluate BODY forms on each call line in FILE.
@@ -1241,7 +1242,7 @@ may be specified in the properties of the current outline entry."
;; get block body less properties, protective commas, and indentation
(with-temp-buffer
(save-match-data
- (insert (org-babel-strip-protective-commas body lang))
+ (insert (org-unescape-code-in-string body))
(unless preserve-indentation (org-do-remove-indentation))
(buffer-string)))
(org-babel-merge-params
@@ -1258,8 +1259,7 @@ may be specified in the properties of the current outline entry."
(let* ((lang (org-no-properties (match-string 2)))
(lang-headers (intern (concat "org-babel-default-header-args:" lang))))
(list lang
- (org-babel-strip-protective-commas
- (org-no-properties (match-string 5)) lang)
+ (org-unescape-code-in-string (org-no-properties (match-string 5)))
(org-babel-merge-params
org-babel-default-inline-header-args
(org-babel-params-from-properties lang)
@@ -1937,10 +1937,10 @@ code ---- the results are extracted in the syntax of the source
((member "prepend" result-params)))) ; already there
(setq results-switches
(if results-switches (concat " " results-switches) ""))
- (let ((wrap (lambda (start finish &optional escape)
+ (let ((wrap (lambda (start finish)
(goto-char end) (insert (concat finish "\n"))
(goto-char beg) (insert (concat start "\n"))
- (if escape (org-add-protective-commas (point) end))
+ (org-escape-code-in-region (point) end)
(goto-char end) (goto-char (point-at-eol))
(setq end (point-marker))))
(proper-list-p (lambda (it) (and (listp it) (null (cdr (last it)))))))
@@ -1987,7 +1987,7 @@ code ---- the results are extracted in the syntax of the source
((member "latex" result-params)
(funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
((member "org" result-params)
- (funcall wrap "#+BEGIN_SRC org" "#+END_SRC" 'escape))
+ (funcall wrap "#+BEGIN_SRC org" "#+END_SRC"))
((member "code" result-params)
(funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
"#+END_SRC"))
@@ -2370,17 +2370,6 @@ block but are passed literally to the \"example-block\"."
(funcall nb-add (buffer-substring index (point-max))))
new-body))
-(defun org-babel-strip-protective-commas (body &optional lang)
- "Strip protective commas from bodies of source blocks."
- (with-temp-buffer
- (insert body)
- (if (and lang (string= lang "org"))
- (progn (goto-char (point-min))
- (while (re-search-forward "^[ \t]*\\(,\\)" nil t)
- (replace-match "" nil nil nil 1)))
- (org-strip-protective-commas (point-min) (point-max)))
- (buffer-string)))
-
(defun org-babel-script-escape (str &optional force)
"Safely convert tables into elisp lists."
(let (in-single in-double out)
@@ -2599,6 +2588,8 @@ of `org-babel-temporary-directory'."
(provide 'ob)
-
+;; Local variables:
+;; generated-autoload-file: "org-loaddefs.el"
+;; End:
;;; ob.el ends here