emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH 07/10] Simplify org-babel-execute-src-block


From: Aaron Ecay
Subject: [O] [PATCH 07/10] Simplify org-babel-execute-src-block
Date: Mon, 1 Apr 2013 01:42:21 -0400

* lisp/ob-core.el (org-babel-execute-src-block): Simplify control flow

Avoid potential duplication of org-babel-process-params call.  Also
makes the code simpler.
---
 lisp/ob-core.el | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index c69b736..d8c11ee 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -557,13 +557,11 @@ Optionally supply a value for PARAMS which will be merged 
with
 the header arguments specified at the front of the source code
 block."
   (interactive)
-  (let* ((info (or info (org-babel-get-src-block-info)))
-        (merged-params (org-babel-merge-params (nth 2 info) params)))
-    (when (org-babel-check-evaluate
-          (let ((i info)) (setf (nth 2 i) merged-params) i))
-      (let* ((params (if params
-                        (org-babel-process-params merged-params)
-                      (nth 2 info)))
+  (let* ((info (or info (org-babel-get-src-block-info 'light))))
+    (setf (nth 2 info) (org-babel-merge-params (nth 2 info) params))
+    (when (org-babel-check-evaluate info)
+      (setf (nth 2 info) (org-babel-process-params (nth 2 info)))
+      (let* ((params (nth 2 info))
             (cachep (and (not arg) (cdr (assoc :cache params))
                           (string= "yes" (cdr (assoc :cache params)))))
             (new-hash (when cachep (org-babel-sha1-hash info)))
@@ -578,8 +576,7 @@ block."
            (let ((result (org-babel-read-result)))
              (message (replace-regexp-in-string
                        "%" "%%" (format "%S" result))) result)))
-        ((org-babel-confirm-evaluate
-          (let ((i info)) (setf (nth 2 i) merged-params) i))
+        ((org-babel-confirm-evaluate info)
          (let* ((lang (nth 0 info))
                 (result-params (cdr (assoc :result-params params)))
                 (body (setf (nth 1 info)
-- 
1.8.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]