|
@@ -39,7 +39,6 @@
|
|
(declare-function show-all "outline" ())
|
|
(declare-function show-all "outline" ())
|
|
(declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS))
|
|
(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-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"
|
|
(declare-function tramp-compat-make-temp-file "tramp-compat"
|
|
(filename &optional dir-flag))
|
|
(filename &optional dir-flag))
|
|
(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault))
|
|
(declare-function tramp-dissect-file-name "tramp" (name &optional nodefault))
|
|
@@ -64,7 +63,6 @@
|
|
(declare-function org-cycle "org" (&optional arg))
|
|
(declare-function org-cycle "org" (&optional arg))
|
|
(declare-function org-uniquify "org" (list))
|
|
(declare-function org-uniquify "org" (list))
|
|
(declare-function org-current-level "org" ())
|
|
(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-table-import "org-table" (file arg))
|
|
(declare-function org-add-hook "org-compat"
|
|
(declare-function org-add-hook "org-compat"
|
|
(hook function &optional append local))
|
|
(hook function &optional append local))
|
|
@@ -87,10 +85,10 @@
|
|
(declare-function org-list-struct "org-list" ())
|
|
(declare-function org-list-struct "org-list" ())
|
|
(declare-function org-list-prevs-alist "org-list" (struct))
|
|
(declare-function org-list-prevs-alist "org-list" (struct))
|
|
(declare-function org-list-get-list-end "org-list" (item struct prevs))
|
|
(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-remove-if "org" (predicate seq))
|
|
(declare-function org-completing-read "org" (&rest args))
|
|
(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))
|
|
|
|
|
|
(defgroup org-babel nil
|
|
(defgroup org-babel nil
|
|
"Code block evaluation and management in `org-mode' documents."
|
|
"Code block evaluation and management in `org-mode' documents."
|
|
@@ -1241,7 +1239,7 @@ may be specified in the properties of the current outline entry."
|
|
;; get block body less properties, protective commas, and indentation
|
|
;; get block body less properties, protective commas, and indentation
|
|
(with-temp-buffer
|
|
(with-temp-buffer
|
|
(save-match-data
|
|
(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))
|
|
(unless preserve-indentation (org-do-remove-indentation))
|
|
(buffer-string)))
|
|
(buffer-string)))
|
|
(org-babel-merge-params
|
|
(org-babel-merge-params
|
|
@@ -1258,8 +1256,7 @@ may be specified in the properties of the current outline entry."
|
|
(let* ((lang (org-no-properties (match-string 2)))
|
|
(let* ((lang (org-no-properties (match-string 2)))
|
|
(lang-headers (intern (concat "org-babel-default-header-args:" lang))))
|
|
(lang-headers (intern (concat "org-babel-default-header-args:" lang))))
|
|
(list 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-merge-params
|
|
org-babel-default-inline-header-args
|
|
org-babel-default-inline-header-args
|
|
(org-babel-params-from-properties lang)
|
|
(org-babel-params-from-properties lang)
|
|
@@ -1937,10 +1934,10 @@ code ---- the results are extracted in the syntax of the source
|
|
((member "prepend" result-params)))) ; already there
|
|
((member "prepend" result-params)))) ; already there
|
|
(setq results-switches
|
|
(setq results-switches
|
|
(if results-switches (concat " " 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 end) (insert (concat finish "\n"))
|
|
(goto-char beg) (insert (concat start "\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))
|
|
(goto-char end) (goto-char (point-at-eol))
|
|
(setq end (point-marker))))
|
|
(setq end (point-marker))))
|
|
(proper-list-p (lambda (it) (and (listp it) (null (cdr (last it)))))))
|
|
(proper-list-p (lambda (it) (and (listp it) (null (cdr (last it)))))))
|
|
@@ -1987,7 +1984,7 @@ code ---- the results are extracted in the syntax of the source
|
|
((member "latex" result-params)
|
|
((member "latex" result-params)
|
|
(funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
|
|
(funcall wrap "#+BEGIN_LaTeX" "#+END_LaTeX"))
|
|
((member "org" result-params)
|
|
((member "org" result-params)
|
|
- (funcall wrap "#+BEGIN_SRC org" "#+END_SRC" 'escape))
|
|
|
|
|
|
+ (funcall wrap "#+BEGIN_SRC org" "#+END_SRC"))
|
|
((member "code" result-params)
|
|
((member "code" result-params)
|
|
(funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
|
|
(funcall wrap (format "#+BEGIN_SRC %s%s" (or lang "none") results-switches)
|
|
"#+END_SRC"))
|
|
"#+END_SRC"))
|
|
@@ -2370,17 +2367,6 @@ block but are passed literally to the \"example-block\"."
|
|
(funcall nb-add (buffer-substring index (point-max))))
|
|
(funcall nb-add (buffer-substring index (point-max))))
|
|
new-body))
|
|
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)
|
|
(defun org-babel-script-escape (str &optional force)
|
|
"Safely convert tables into elisp lists."
|
|
"Safely convert tables into elisp lists."
|
|
(let (in-single in-double out)
|
|
(let (in-single in-double out)
|