ag91 / ob-clojure-literate-extras

Extends ob-clojure to support including dependencies
1 stars 0 forks source link

Error after loading and try to eval clojure code #1

Open burinc opened 10 months ago

burinc commented 10 months ago

From the readme, I try following the steps and kept getting the following error:

apply: Wrong number of arguments: (lambda (expanded params) "Evaluate EXPANDED code block with PARAMS using cider." (condition-case nil (require 'cider) (user-error "cider not available")) (let ((connection (cider-current-connection (cdr (assq :target params)))) (result-params (cdr (assq :result-params params))) result0) (if connection nil (let ((my/cider-extra-deps (alist-get :deps params))) (sesman-start-session 'CIDER))) (if (not connection) (setq result0 "Please reevaluate when nREPL is connected") (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert expanded) (goto-char (point-min)) (while (not (looking-at "\\s-*\\'")) (let* (... ... ...) (sit-for 0.1) (let ... ...)))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (ob-clojure-string-or-list (reverse (delete "" (mapcar #'(lambda (r) (replace-regexp-in-string "nil" "" ...)) result0))))))), 3

I am using Emacs 28.2 with Doom emacs. Any idea that I may have missed?

Before these changes, I was able to evaluate the Clojure code with the following code block:

#+begin_src clojure
(+ 1 2)
#+end_src
ag91 commented 10 months ago

hi @burinc , thanks for reporting this. I interpret that error as an extra argument was somewhat passed to ob-clojure-eval-with-cider. I cannot reproduce this, but if you get the latest version of the script and then redefine the following function:

(defun ob-clojure-extras-setup-shadow-cljs-project-if-possible (orig-fun &rest args)
  (if-let* ((headers (nth 1 args))
            (_ (equal "cljs" (alist-get :target headers)))
            (cider-default-cljs-repl 'shadow)
            (cider-shadow-default-options
             (ob-clojure-extras-cider-run-projectless-cljs-repl (alist-get :shadowcljs-type headers)
                                                                (alist-get :deps headers)
                                                                (alist-get :shadowcljs-extra headers)))
            (_ (message "what is in here? %S" args)))
      (progn
        (while (not (car-safe (nrepl-extract-ports (cider--file-path "."))))
          (message "Waiting for shadow-cljs to connect...")
          (sleep-for 1))
        (cider-connect-cljs (list
                             :host "localhost"
                             :port (car (nrepl-extract-ports (cider--file-path ".")))
                             :project-dir (concat "~/" (file-relative-name "." "~"))
                             :cljs-repl-type 'shadow))
        (apply orig-fun args))
    (apply orig-fun args)))

maybe we will find out the problem?

burinc commented 10 months ago

Thanks @ag91

I will give it a try and report back the result.

Thanks