|
@@ -226,27 +226,28 @@ block."
|
|
|
(if (boundp 'call-process-region-original) call-process-region-original
|
|
|
(symbol-function 'call-process-region)))
|
|
|
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)
|
|
|
"Load the body of the current source-code block. Evaluate the
|