Simon Cossar <[email protected]> writes:

> I'll try creating a patch. I'm unsure about adding tests for the
> changes. In the tests I have included, the first test does not rely on
> having a Clojure executable, the second test does. I've only run the
> tests from within Emacs. They don't seem to get picked up when I run
> `make test` from the command line. I'll look into that some more later
> on today.

Thanks for the patch!
Would you be interested to fix some other remaining issues in the
`org-babel-expand-body:clojure'? There are still things like

   (eq org-babel-clojure-backend 'cider)

that do not look like they should belong there.

As for the tests, the first test actually depends on clojure executable,
although indirectly - the value of `org-babel-clojure-backend' depends
on what is installed on the system:

    (defcustom org-babel-clojure-backend (cond
                                          ((executable-find "bb") 'babashka)
                                          ((executable-find "clojure") 
'clojure-cli)
                                          ((featurep 'cider) 'cider)
                                          ((featurep 'inf-clojure) 'inf-clojure)
                                          ((featurep 'slime) 'slime)
                                          (t nil))

To run babel tests from command line, you need to explicitly activate
them. Many babel tests are disabled by default.
You need to set several variables for make (either from command line or
in local.mk). For example, here is what I use:

    BTEST_POST  = -L ~/.emacs.d/straight/repos/geiser/elisp -L
    ~/.emacs.d/straight/repos/guile -L ~/.emacs.d/straight/repos/inf-ruby
    BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave perl python java 
sqlite eshell calc lua R scheme ruby plantuml

> Subject: [PATCH 1/2] lisp/ob-clojure.el: Stop tangling code that is used for
>  evaluation
>
> * org-clojure.el (org-babel-expand-body:clojure,
> ob-clojure--prepare-for-evaluation): Extract code that is used for
> evaluation of source blocks into its own function.
> (org-babel-execute:clojure): Call ob-clojure--prepare-for-evaluation
> on expanded source block body.

Nitpick: `ob-clojure--prepare-for-evaluation' (quote).

> -    ;; If the result param is set to "output" we don't have to do
> -    ;; anything special and just let the backend handle everything
> -    (if (member "output" result-params)
> -        body
> -
> -      ;; If the result is not "output" (i.e. it's "value"), disable
> -      ;; stdout output and print the last returned value.  Use pprint
> -      ;; instead of prn when results param is "pp" or "code".

You removed these comments in the patch. Is there any rationale? Or just
an omission.

>  ;;; Code:
> +(require 'org-test "../testing/org-test")

Looks like your patch is not against the latest main.
We already have this line in this file on the latest main.
  
> +;; execute
> +(ert-deftest ob-clojure/org-babel-execute ()
> +  "org-babel-execute:clojure correctly handles :result-params"
> +  (skip-unless (executable-find "clojure"))

This hard-codes the test only for clojure.
An alternative would be checking for the value of
`org-babel-clojure-backend' (automatically set).

> +  (let ((org-babel-clojure-backend 'clojure-cli))

Same problem here. Why not using the default backend (if any)?

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>

Reply via email to