Просмотр исходного кода

Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

Carsten Dominik 15 лет назад
Родитель
Сommit
0e530ee795
2 измененных файлов с 22 добавлено и 25 удалено
  1. 0 4
      ORGWEBPAGE/Changes.org
  2. 22 21
      contrib/babel/lisp/org-babel.el

+ 0 - 4
ORGWEBPAGE/Changes.org

@@ -514,12 +514,9 @@ around org-babel.
   Thanks to Maurizio Vitale for this suggestion.
   Thanks to Maurizio Vitale for this suggestion.
 - Variable references which look like lisp forms are now
 - Variable references which look like lisp forms are now
   evaluated.
   evaluated.
-- Inline source blocks will always return string output.
 - No longer adding extension during tangling when filename is
 - No longer adding extension during tangling when filename is
   provided.
   provided.
   Thanks to Martin G. Skjæveland and Nicolas Girard for prompting this.
   Thanks to Martin G. Skjæveland and Nicolas Girard for prompting this.
-- Code block parameters are now available when initializing a
-  session.
 - Added `org-babel-execute-hook' which runs after code block
 - Added `org-babel-execute-hook' which runs after code block
   execution.
   execution.
 - Working directories and remote execution
 - Working directories and remote execution
@@ -543,7 +540,6 @@ around org-babel.
 - org-R removed from contrib.
 - org-R removed from contrib.
 - gnuplot can now return it's string output -- when session is
 - gnuplot can now return it's string output -- when session is
   set to "none".
   set to "none".
-- Prevent quoting of strings in shell variables.
 - Now including source code block arguments w/source name on
 - Now including source code block arguments w/source name on
   export.
   export.
 - Now able to reference file links as results.
 - Now able to reference file links as results.

+ 22 - 21
contrib/babel/lisp/org-babel.el

@@ -226,27 +226,28 @@ block."
 	  (if (boundp 'call-process-region-original) call-process-region-original
 	  (if (boundp 'call-process-region-original) call-process-region-original
 	    (symbol-function 'call-process-region)))
 	    (symbol-function 'call-process-region)))
          result)
          result)
-    ;; (message "params=%S" params) ;; debugging
-    (flet ((call-process-region (&rest args)
-				(apply 'org-babel-tramp-handle-call-process-region args)))
-      (unless (member lang org-babel-interpreters)
-	(error "Language is not in `org-babel-interpreters': %s" lang))
-      (if (and (not arg) new-hash (equal new-hash old-hash))
-	  (save-excursion ;; return cached result
-	    (goto-char (org-babel-where-is-src-block-result nil info))
-	    (move-end-of-line 1) (forward-char 1)
-	    (setq result (org-babel-read-result))
-	    (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result)
-	(setq result (funcall cmd body params))
-	(if (eq result-type 'value)
-	    (setq result (if (and (or (member "vector" result-params)
-				      (member "table" result-params))
-				  (not (listp result)))
-			     (list (list result))
-			   result)))
-	(org-babel-insert-result result result-params info new-hash)
-	(run-hooks 'org-babel-after-execute-hook)
-	result))))
+    (unwind-protect
+        (flet ((call-process-region (&rest args)
+                                    (apply 'org-babel-tramp-handle-call-process-region args)))
+          (unless (member lang org-babel-interpreters)
+            (error "Language is not in `org-babel-interpreters': %s" lang))
+          (if (and (not arg) new-hash (equal new-hash old-hash))
+              (save-excursion ;; return cached result
+                (goto-char (org-babel-where-is-src-block-result nil info))
+                (move-end-of-line 1) (forward-char 1)
+                (setq result (org-babel-read-result))
+                (message (replace-regexp-in-string "%" "%%" (format "%S" result))) result)
+            (setq result (funcall cmd body params))
+            (if (eq result-type 'value)
+                (setq result (if (and (or (member "vector" result-params)
+                                          (member "table" result-params))
+                                      (not (listp result)))
+                                 (list (list result))
+                               result)))
+            (org-babel-insert-result result result-params info new-hash)
+            (run-hooks 'org-babel-after-execute-hook)
+            result))
+      (setq call-process-region 'call-process-region-original))))
 
 
 (defun org-babel-load-in-session (&optional arg info)
 (defun org-babel-load-in-session (&optional arg info)
   "Load the body of the current source-code block.  Evaluate the
   "Load the body of the current source-code block.  Evaluate the