[-- Attachment #1: Type: text/plain, Size: 190 bytes --] 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 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: remove unused code.patch --] [-- Type: text/x-diff; name="0001-lisp-ob-octave.el-remove-org-babel-prep-session-octa.patch", Size: 1848 bytes --] From f91562d9ea36d7f76f222e457c8fd1b0570e7e3d Mon Sep 17 00:00:00 2001 From: Leo Butler <leo.butler@umanitoba.ca> 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 &optional 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 (&optional session params) "Create a matlab inferior process buffer. If there is not a current inferior-process-buffer in SESSION then -- 2.39.1
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.
Leo Butler <Leo.Butler@umanitoba.ca> 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 <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
On Fri, Feb 10 2023, Max Nikulin <manikulin@gmail.com> 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