Re: [PATCH] remove unused code in ob-octave.el

2023-02-14 Thread Leo Butler
On Fri, Feb 10 2023, Max Nikulin  wrote:

> On 10/02/2023 04:21, Leo Butler wrote:
>> In lisp/ob-octave.el:
>> What is the point of ob-octave-prep-session:octave or its brother,
>> ob-octave-prep-session:matlab?
>> These two functions are unused in the existing code.
>
> Have you checked the following? I am not familiar with org-babel code.
>
> grep -nH org-babel-prep-session lisp/ob-core.el
> lisp/ob-core.el:1041:  (prep-cmd (intern (concat
> "org-babel-prep-session:" lang
> lisp/ob-core.el:1050: (error "No org-babel-prep-session function for
> %s!" lang))
>
> Do test passes when you patch is applied? It might mean that test
> coverage is not perfect.

Yes, the tests pass after removing the code.

I can see from your and Ihor's response that my suggestion is
wrongheaded. 

After looking more carefully at ob-core, I am not sure how I could write
a test for the prep-session code, though. The comment and docstring in
ob-template.el does not help me, I am afraid. And the existing
session-related tests do not touch the prep-session code.

I'll poke around in other ob-*.el code and see if I can figure it out.

Leo


Re: [PATCH] remove unused code in ob-octave.el

2023-02-10 Thread Ihor Radchenko
Leo Butler  writes:

> What is the point of ob-octave-prep-session:octave or its brother,
> ob-octave-prep-session:matlab?
>
> These two functions are unused in the existing code.

They are used.
ob-core.el library prescribed certain function names to be defined in
order to declare new babel backend:
- org-babel-default-header-args:lang
- org-babel-execute:lang
- org-babel-expand-body:lang
- org-babel-variable-assignments:lang
- org-babel-header-args:lang
- org-babel-load-session:lang
- org-babel-lang-initiate-session
- org-babel-prep-session:lang

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] remove unused code in ob-octave.el

2023-02-09 Thread Max Nikulin

On 10/02/2023 04:21, Leo Butler wrote:

In lisp/ob-octave.el:

What is the point of ob-octave-prep-session:octave or its brother,
ob-octave-prep-session:matlab?

These two functions are unused in the existing code.


Have you checked the following? I am not familiar with org-babel code.

grep -nH org-babel-prep-session lisp/ob-core.el
lisp/ob-core.el:1041:	 (prep-cmd (intern (concat 
"org-babel-prep-session:" lang
lisp/ob-core.el:1050:	(error "No org-babel-prep-session function for 
%s!" lang))


Do test passes when you patch is applied? It might mean that test 
coverage is not perfect.




[PATCH] remove unused code in ob-octave.el

2023-02-09 Thread Leo Butler
In lisp/ob-octave.el:

What is the point of ob-octave-prep-session:octave or its brother,
ob-octave-prep-session:matlab?

These two functions are unused in the existing code.

Leo

From f91562d9ea36d7f76f222e457c8fd1b0570e7e3d Mon Sep 17 00:00:00 2001
From: Leo Butler 
Date: Thu, 9 Feb 2023 11:02:04 -0600
Subject: [PATCH] lisp/ob-octave.el: remove
 org-babel-prep-session:{octave,matlab}

* lisp/ob-octave.el (org-babel-prep-session:matlab,
org-babel-prep-session:octave):  Remove unused functions.
---
 lisp/ob-octave.el | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/lisp/ob-octave.el b/lisp/ob-octave.el
index 9bf16b984..24537ad57 100644
--- a/lisp/ob-octave.el
+++ b/lisp/ob-octave.el
@@ -104,10 +104,6 @@ end")
(org-babel-pick-name
 	(cdr (assq :rowname-names params)) (cdr (assq :rownames params)))
 
-(defun org-babel-prep-session:matlab (session params)
-  "Prepare SESSION according to PARAMS."
-  (org-babel-prep-session:octave session params 'matlab))
-
 (defun org-babel-variable-assignments:octave (params)
   "Return list of octave statements assigning the block's variables."
   (mapcar
@@ -133,17 +129,6 @@ specifying a variable of the same value."
  (t
   (format "%s" var)
 
-(defun org-babel-prep-session:octave (session params  matlabp)
-  "Prepare SESSION according to the header arguments specified in PARAMS."
-  (let* ((session (org-babel-octave-initiate-session session params matlabp))
-	 (var-lines (org-babel-variable-assignments:octave params)))
-(org-babel-comint-in-buffer session
-  (mapc (lambda (var)
-  (end-of-line 1) (insert var) (comint-send-input nil t)
-  (org-babel-comint-wait-for-output session))
-	var-lines))
-session))
-
 (defun org-babel-matlab-initiate-session ( session params)
   "Create a matlab inferior process buffer.
 If there is not a current inferior-process-buffer in SESSION then
-- 
2.39.1