Prechádzať zdrojové kódy

ob: Remove `org-babel-lob-execute'

* lisp/ob-lob.el (org-babel-lob-execute): Remove function
(org-babel-lob-execute-maybe):
* lisp/ob-ref.el (org-babel-ref-resolve):
* testing/lisp/test-ob-header-arg-defaults.el (test-ob-header-arg-defaults/global/call):
(test-ob-header-arg-defaults/tree/overwrite/call):
(test-ob-header-arg-defaults/tree/accumulate/call):
(test-ob-header-arg-defaults/tree/complex/call):
* testing/lisp/test-ob-lob.el (test-ob-lob/named-caching-call-line):
(test-ob-lob/caching-call-line):
(test-ob-lob/call-with-header-arguments): Apply removal.
Nicolas Goaziou 8 rokov pred
rodič
commit
c3b42e917f

+ 0 - 1
lisp/ob-core.el

@@ -81,7 +81,6 @@
 (declare-function org-babel-ref-resolve "ob-ref" (ref))
 (declare-function org-babel-ref-goto-headline-id "ob-ref" (id))
 (declare-function org-babel-ref-headline-body "ob-ref" ())
-(declare-function org-babel-lob-execute-maybe "ob-lob" ())
 (declare-function org-number-sequence "org-compat" (from &optional to inc))
 (declare-function org-at-item-p "org-list" ())
 (declare-function org-list-to-generic "org-list" (LIST PARAMS))

+ 1 - 5
lisp/ob-lob.el

@@ -83,7 +83,7 @@ if so then run the appropriate source block from the Library."
   (interactive)
   (let ((info (org-babel-lob-get-info)))
     (when info
-      (org-babel-lob-execute info)
+      (org-babel-execute-src-block nil info)
       t)))
 
 (defun org-babel-lob--src-info (name)
@@ -153,10 +153,6 @@ compatible with `org-babel-get-src-block-info', which see."
 		 begin)))
 	(_ nil)))))
 
-(defun org-babel-lob-execute (info)
-  "Execute the lob call specified by INFO."
-  (org-babel-execute-src-block nil info))
-
 (provide 'ob-lob)
 
 ;; Local variables:

+ 2 - 3
lisp/ob-ref.el

@@ -52,7 +52,6 @@
 (require 'ob-core)
 (require 'cl-lib)
 
-(declare-function org-babel-lob-execute "ob-lob" (info))
 (declare-function org-babel-lob-get-info "ob-lob" (&optional datum))
 (declare-function org-element-at-point "org-element" ())
 (declare-function org-element-property "org-element" (property element))
@@ -173,8 +172,8 @@ the variable."
 			     (pcase (org-element-type e)
 			       (`babel-call
 				(throw :found
-				       (org-babel-lob-execute
-					(org-babel-lob-get-info e))))
+				       (org-babel-execute-src-block
+					nil (org-babel-lob-get-info e))))
 			       (`src-block
 				(throw :found
 				       (org-babel-execute-src-block

+ 4 - 4
testing/lisp/test-ob-header-arg-defaults.el

@@ -25,7 +25,7 @@
    (org-babel-next-src-block 1)
    (forward-line -1)
    (should (equal "ge1/gh2/go3/ge4/ge5/--6/--7/--8/--9"
-		  (org-babel-lob-execute (org-babel-lob-get-info))))))
+		  (org-babel-execute-src-block nil (org-babel-lob-get-info))))))
 
 (ert-deftest test-ob-header-arg-defaults/global/noweb ()
   (org-test-at-id "3fdadb69-5d15-411e-aad0-f7860cdd7816"
@@ -38,7 +38,7 @@
    (org-babel-next-src-block 1)
    (forward-line -1)
    (should (equal "ge1/gh2/go3/ge4/ge5/to6/th7/te8/--9"
-		  (org-babel-lob-execute (org-babel-lob-get-info))))))
+		  (org-babel-execute-src-block nil (org-babel-lob-get-info))))))
 
 (ert-deftest test-ob-header-arg-defaults/tree/overwrite/noweb ()
   (org-test-at-id "a9cdfeda-9f31-4bb5-b694-2cf452f07dfd"
@@ -51,7 +51,7 @@
    (org-babel-next-src-block 1)
    (forward-line -1)
    (should (equal "ge1/th2/th3/ge4/te5/to6"
-		  (org-babel-lob-execute (org-babel-lob-get-info))))))
+		  (org-babel-execute-src-block nil (org-babel-lob-get-info))))))
 
 (ert-deftest test-ob-header-arg-defaults/tree/accumulate/noweb ()
   (org-test-at-id "1d97d258-fd50-4107-a095-e4625bffc57b"
@@ -64,7 +64,7 @@
    (org-babel-next-src-block 1)
    (forward-line -1)
    (should (equal "gh1/th2/go3/gh4/te5/to6"
-		  (org-babel-lob-execute (org-babel-lob-get-info))))))
+		  (org-babel-execute-src-block nil (org-babel-lob-get-info))))))
 
 (ert-deftest test-ob-header-arg-defaults/tree/complex/noweb ()
   (org-test-at-id "fa0e912d-d9b4-47b0-9f9e-1cbb39f7cbc2"

+ 30 - 25
testing/lisp/test-ob-lob.el

@@ -40,41 +40,42 @@
 (ert-deftest test-ob-lob/call-with-header-arguments ()
   "Test the evaluation of a library of babel #+call: line."
   (letf (((symbol-function 'org-babel-insert-result)
-	     (symbol-function 'ignore)))
+	  (symbol-function 'ignore)))
     (org-test-at-id "fab7e291-fde6-45fc-bf6e-a485b8bca2f0"
       (move-beginning-of-line 1)
       (forward-line 6)
       (message (buffer-substring (point-at-bol) (point-at-eol)))
-      (should (string= "testing" (org-babel-lob-execute
-				  (org-babel-lob-get-info))))
+      (should (string= "testing" (org-babel-execute-src-block
+				  nil (org-babel-lob-get-info))))
       (forward-line 1)
-      (should (string= "testing" (caar (org-babel-lob-execute
-					(org-babel-lob-get-info)))))
+      (should (string= "testing" (caar (org-babel-execute-src-block
+					nil (org-babel-lob-get-info)))))
       (forward-line 1)
-      (should (string= "testing" (org-babel-lob-execute
-				  (org-babel-lob-get-info))))
+      (should (string= "testing" (org-babel-execute-src-block
+				  nil (org-babel-lob-get-info))))
       (forward-line 1)
-      (should (string= "testing" (caar (org-babel-lob-execute
-					(org-babel-lob-get-info)))))
+      (should (string= "testing" (caar (org-babel-execute-src-block
+					nil (org-babel-lob-get-info)))))
       (forward-line 1)
-      (should (string= "testing" (org-babel-lob-execute
-				  (org-babel-lob-get-info))))
+      (should (string= "testing" (org-babel-execute-src-block
+				  nil (org-babel-lob-get-info))))
       (forward-line 1)
-      (should (string= "testing" (caar (org-babel-lob-execute
-					(org-babel-lob-get-info)))))
+      (should (string= "testing" (caar (org-babel-execute-src-block
+					nil (org-babel-lob-get-info)))))
       (forward-line 1) (beginning-of-line) (forward-char 27)
-      (should (string= "testing" (org-babel-lob-execute
-				  (org-babel-lob-get-info))))
+      (should (string= "testing" (org-babel-execute-src-block
+				  nil (org-babel-lob-get-info))))
       (forward-line 1) (beginning-of-line) (forward-char 27)
-      (should (string= "testing" (caar (org-babel-lob-execute
-					(org-babel-lob-get-info)))))
+      (should (string= "testing" (caar (org-babel-execute-src-block
+					nil (org-babel-lob-get-info)))))
       (forward-line 1) (beginning-of-line)
-      (should (= 4 (org-babel-lob-execute (org-babel-lob-get-info))))
+      (should (= 4 (org-babel-execute-src-block nil (org-babel-lob-get-info))))
       (forward-line 1)
-      (should (string= "testing" (org-babel-lob-execute
-				  (org-babel-lob-get-info))))
+      (should (string= "testing" (org-babel-execute-src-block
+				  nil (org-babel-lob-get-info))))
       (forward-line 1)
-      (should (string= "123" (org-babel-lob-execute (org-babel-lob-get-info)))))))
+      (should (string= "123" (org-babel-execute-src-block
+			      nil (org-babel-lob-get-info)))))))
 
 (ert-deftest test-ob-lob/export-lob-lines ()
   "Test the export of a variety of library babel call lines."
@@ -118,9 +119,11 @@ for export
 <point>#+call: call-line-caching-example(\"qux\") :cache yes
 "
       ;; first execution should flip value to t
-      (should (equal (org-babel-lob-execute (org-babel-lob-get-info)) 1))
+      (should
+       (eq (org-babel-execute-src-block nil (org-babel-lob-get-info)) 1))
       ;; if cached, second evaluation will retain the t value
-      (should (equal (org-babel-lob-execute (org-babel-lob-get-info)) 1)))))
+      (should
+       (eq (org-babel-execute-src-block nil (org-babel-lob-get-info)) 1)))))
 
 (ert-deftest test-ob-lob/named-caching-call-line ()
   (let ((temporary-value-for-test 0))
@@ -134,9 +137,11 @@ for export
 <point>#+call: call-line-caching-example(\"qux\") :cache yes
 "
       ;; first execution should flip value to t
-      (should (equal (org-babel-lob-execute (org-babel-lob-get-info)) 1))
+      (should
+       (eq (org-babel-execute-src-block nil (org-babel-lob-get-info)) 1))
       ;; if cached, second evaluation will retain the t value
-      (should (equal (org-babel-lob-execute (org-babel-lob-get-info)) 1)))))
+      (should
+       (eq (org-babel-execute-src-block nil (org-babel-lob-get-info)) 1)))))
 
 (provide 'test-ob-lob)