From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: [PATCH 07/10] Simplify org-babel-execute-src-block Date: Mon, 1 Apr 2013 01:42:21 -0400 Message-ID: <1364794944-13826-8-git-send-email-aaronecay@gmail.com> References: <1364794944-13826-1-git-send-email-aaronecay@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMXVt-0002kr-OE for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 01:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMXVs-0000wP-Ge for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 01:42:37 -0400 Received: from mail-qe0-f45.google.com ([209.85.128.45]:64593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMXVs-0000wE-Ca for emacs-orgmode@gnu.org; Mon, 01 Apr 2013 01:42:36 -0400 Received: by mail-qe0-f45.google.com with SMTP id b4so1059887qen.32 for ; Sun, 31 Mar 2013 22:42:36 -0700 (PDT) In-Reply-To: <1364794944-13826-1-git-send-email-aaronecay@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * 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