Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 12 years ago
parent
commit
9bc7f70639
1 changed files with 9 additions and 10 deletions
  1. 9 10
      lisp/ob-core.el

+ 9 - 10
lisp/ob-core.el

@@ -521,21 +521,20 @@ Optionally supply a value for PARAMS which will be merged with
 the header arguments specified at the front of the source code
 the header arguments specified at the front of the source code
 block."
 block."
   (interactive)
   (interactive)
-  (let ((info (or info (org-babel-get-src-block-info))))
+  (let* ((info (or info (org-babel-get-src-block-info)))
+	 (merged-params (org-babel-merge-params (nth 2 info) params)))
     (when (org-babel-confirm-evaluate
     (when (org-babel-confirm-evaluate
-	   (let ((i info))
-	     (setf (nth 2 i) (org-babel-merge-params (nth 2 info) params))
-	     i))
+	   (let ((i info)) (setf (nth 2 i) merged-params) i))
       (let* ((lang (nth 0 info))
       (let* ((lang (nth 0 info))
 	     (params (if params
 	     (params (if params
-			 (org-babel-process-params
-			  (org-babel-merge-params (nth 2 info) params))
+			 (org-babel-process-params merged-params)
 		       (nth 2 info)))
 		       (nth 2 info)))
-	     (cache? (and (not arg) (cdr (assoc :cache params))
+	     (cache-p (and (not arg) (cdr (assoc :cache params))
 			  (string= "yes" (cdr (assoc :cache params)))))
 			  (string= "yes" (cdr (assoc :cache params)))))
 	     (result-params (cdr (assoc :result-params params)))
 	     (result-params (cdr (assoc :result-params params)))
-	     (new-hash (when cache? (org-babel-sha1-hash info)))
-	     (old-hash (when cache? (org-babel-current-result-hash)))
+	     (new-hash (when cache-p (org-babel-sha1-hash info)))
+	     (old-hash (when cache-p (org-babel-current-result-hash)))
+	     (cache-current-p (and (not arg) new-hash (equal new-hash old-hash)))
 	     (body (setf (nth 1 info)
 	     (body (setf (nth 1 info)
 			 (if (org-babel-noweb-p params :eval)
 			 (if (org-babel-noweb-p params :eval)
 			     (org-babel-expand-noweb-references info)
 			     (org-babel-expand-noweb-references info)
@@ -562,7 +561,7 @@ block."
 			  (funcall lang-check (symbol-name
 			  (funcall lang-check (symbol-name
 					       (cdr (assoc lang org-src-lang-modes))))
 					       (cdr (assoc lang org-src-lang-modes))))
 			  (error "No org-babel-execute function for %s!" lang))))
 			  (error "No org-babel-execute function for %s!" lang))))
-	      (if (and (not arg) new-hash (equal new-hash old-hash))
+	      (if cache-current-p
 		  (save-excursion ;; return cached result
 		  (save-excursion ;; return cached result
 		    (goto-char (org-babel-where-is-src-block-result nil info))
 		    (goto-char (org-babel-where-is-src-block-result nil info))
 		    (end-of-line 1) (forward-char 1)
 		    (end-of-line 1) (forward-char 1)