[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] ob-clojure.el new backend 'inf-clojure not compatible with latest
From: |
stardiviner |
Subject: |
[BUG] ob-clojure.el new backend 'inf-clojure not compatible with latest version inf-clojure |
Date: |
Tue, 28 Apr 2020 17:29:58 +0800 |
User-agent: |
mu4e 1.4; emacs 28.0.50 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Bastien <address@hidden> writes:
> Hi Tim,
>
> thanks for your email.
>
> Tim Cross <address@hidden> writes:
>
>> I wonder if it would make sense to use shadow-cljs rather than cider as
>> a back end for evaluating clojurescript?
>
> I am inclined to question the usefulness of evaluating ClojureScript
> code *at all*.
>
>> More generally, I wonder if there would be any benefit in considering a
>> Clojure CLI Tools back end integration and bypassing CIDER altogether?
>
> Yes, I agree this would be better.
>
> I implemented (in master now) the support of inf-clojure.el to
> evaluate Clojure blocks.
I try to use 'inf-clojure babel eval backend. But I got error:
#+begin_example
Debugger entered--Lisp error: (void-function inf-clojure-cmd)
(inf-clojure-cmd (inf-clojure-project-type))
(let* ((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure"
(format "clojure -A%s" alias) cmd0) cmd0))) (setq comint-prompt-regexp
inf-clojure-comint-prompt-regexp) (funcall-interactively #'inf-clojure cmd)
(goto-char (point-max)))
(progn (let* ((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure"
(format "clojure -A%s" alias) cmd0) cmd0))) (setq comint-prompt-regexp
inf-clojure-comint-prompt-regexp) (funcall-interactively #'inf-clojure cmd)
(goto-char (point-max))))
(unwind-protect (progn (let* ((alias (cdr (assq :alias params))) (cmd0
(inf-clojure-cmd (inf-clojure-project-type))) (cmd (if alias
(replace-regexp-in-string "clojure" (format "clojure -A%s" alias) cmd0) cmd0)))
(setq comint-prompt-regexp inf-clojure-comint-prompt-regexp)
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max))))
(set-window-configuration wconfig))
(let ((wconfig (current-window-configuration))) (unwind-protect (progn (let*
((alias (cdr (assq :alias params))) (cmd0 (inf-clojure-cmd
(inf-clojure-project-type))) (cmd (if alias (replace-regexp-in-string "clojure"
... cmd0) cmd0))) (setq comint-prompt-regexp inf-clojure-comint-prompt-regexp)
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max))))
(set-window-configuration wconfig)))
(if (and inf-clojure-buffer (buffer-live-p (get-buffer inf-clojure-buffer)))
nil (let ((wconfig (current-window-configuration))) (unwind-protect (progn
(let* ((alias (cdr ...)) (cmd0 (inf-clojure-cmd ...)) (cmd (if alias ...
cmd0))) (setq comint-prompt-regexp inf-clojure-comint-prompt-regexp)
(funcall-interactively #'inf-clojure cmd) (goto-char (point-max))))
(set-window-configuration wconfig))) (sit-for 1))
ob-clojure-eval-with-inf-clojure("(print \"hello, world\")" ((:colname-names)
(:rowname-names) (:result-params "replace") (:result-type . value) (:results .
"replace") (:exports . "") (:session . "none") (:hlines . "no") (:tangle .
"no") (:cache . "yes") (:mkdirp . "yes") (:show-process . "no") (:noweb .
"yes") (:eval . "yes")))
(cond ((eq org-babel-clojure-backend 'inf-clojure)
(ob-clojure-eval-with-inf-clojure expanded params)) ((eq
org-babel-clojure-backend 'cider) (ob-clojure-eval-with-cider expanded params))
((eq org-babel-clojure-backend 'slime) (ob-clojure-eval-with-slime expanded
params)))
(setq result (cond ((eq org-babel-clojure-backend 'inf-clojure)
(ob-clojure-eval-with-inf-clojure expanded params)) ((eq
org-babel-clojure-backend 'cider) (ob-clojure-eval-with-cider expanded params))
((eq org-babel-clojure-backend 'slime) (ob-clojure-eval-with-slime expanded
params))))
(let* ((expanded (org-babel-expand-body:clojure body params)) (result-params
(cdr (assq :result-params params))) result) (setq result (cond ((eq
org-babel-clojure-backend 'inf-clojure) (ob-clojure-eval-with-inf-clojure
expanded params)) ((eq org-babel-clojure-backend 'cider)
(ob-clojure-eval-with-cider expanded params)) ((eq org-babel-clojure-backend
'slime) (ob-clojure-eval-with-slime expanded params)))) (let ((--params
result-params)) (if (member "none" --params) nil (if (or (member "scalar"
--params) (member "verbatim" --params) (member "html" --params) (member "code"
--params) (member "pp" --params) (member "file" --params) (and (or (member
"output" --params) (member "raw" --params) (member "org" --params) (member
"drawer" --params)) (not (member "table" --params)))) result (condition-case
nil (org-babel-script-escape result) (error result))))))
org-babel-execute:clojure("(print \"hello, world\")" ((:colname-names)
(:rowname-names) (:result-params "replace") (:result-type . value) (:results .
"replace") (:exports . "") (:session . "none") (:hlines . "no") (:tangle .
"no") (:cache . "yes") (:mkdirp . "yes") (:show-process . "no") (:noweb .
"yes") (:eval . "yes")))
funcall(org-babel-execute:clojure "(print \"hello, world\")"
((:colname-names) (:rowname-names) (:result-params "replace") (:result-type .
value) (:results . "replace") (:exports . "") (:session . "none") (:hlines .
"no") (:tangle . "no") (:cache . "yes") (:mkdirp . "yes") (:show-process .
"no") (:noweb . "yes") (:eval . "yes")))
(let ((r (funcall cmd body params))) (if (and (eq (cdr (assq :result-type
params)) 'value) (or (member "vector" result-params) (member "table"
result-params)) (not (listp r))) (list (list r)) r))
(setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr (assq
:result-type params)) 'value) (or (member "vector" result-params) (member
"table" result-params)) (not (listp r))) (list (list r)) r)))
(if (member "none" result-params) (progn (funcall cmd body params) (message
"result silenced")) (setq result (let ((r (funcall cmd body params))) (if (and
(eq (cdr (assq :result-type params)) 'value) (or (member "vector"
result-params) (member "table" result-params)) (not (listp r))) (list (list r))
r))) (let ((file (and (member "file" result-params) (cdr (assq :file
params))))) (if file (progn (if (and result (not (or ... ...))) (progn (let
(... ...) (unwind-protect ... ...)))) (setq result file))) (let ((post (cdr
(assq :post params)))) (if post (progn (let ((*this* ...)) (setq result
(org-babel-ref-resolve post)) (if file (progn ...))))))
(org-babel-insert-result result result-params info new-hash lang)))
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params params)))
(body (let ((coderef (nth 6 info)) (expand (if (org-babel-noweb-p params :eval)
(org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef)
expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil
nil 1)))) (dir (cdr (assq :dir params))) (mkdirp (cdr (assq :mkdirp params)))
(default-directory (cond ((not dir) default-directory) ((member mkdirp '("no"
"nil" nil)) (file-name-as-directory (expand-file-name dir))) (t (let ((d ...))
(make-directory d 'parents) d)))) (cmd (intern (concat "org-babel-execute:"
lang))) result) (if (fboundp cmd) nil (error "No org-babel-execute function for
%s!" lang)) (message "executing %s code block%s..." (capitalize lang) (let
((name (nth 4 info))) (if name (format " (%s)" name) ""))) (if (member "none"
result-params) (progn (funcall cmd body params) (message "result silenced"))
(setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr ...)
'value) (or (member "vector" result-params) (member "table" result-params))
(not (listp r))) (list (list r)) r))) (let ((file (and (member "file"
result-params) (cdr (assq :file params))))) (if file (progn (if (and result
(not ...)) (progn (let ... ...))) (setq result file))) (let ((post (cdr (assq
:post params)))) (if post (progn (let (...) (setq result ...) (if file ...)))))
(org-babel-insert-result result result-params info new-hash lang))) (run-hooks
'org-babel-after-execute-hook) result)
(cond (current-cache (save-excursion (goto-char
(org-babel-where-is-src-block-result nil info)) (forward-line)
(skip-chars-forward " \11") (let ((result (org-babel-read-result))) (message
(replace-regexp-in-string "%" "%%" (format "%S" result))) result)))
((org-babel-confirm-evaluate info) (let* ((lang (nth 0 info)) (result-params
(cdr (assq :result-params params))) (body (let ((coderef ...) (expand ...)) (if
(not coderef) expand (replace-regexp-in-string ... "" expand nil nil 1)))) (dir
(cdr (assq :dir params))) (mkdirp (cdr (assq :mkdirp params)))
(default-directory (cond ((not dir) default-directory) ((member mkdirp ...)
(file-name-as-directory ...)) (t (let ... ... d)))) (cmd (intern (concat
"org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No
org-babel-execute function for %s!" lang)) (message "executing %s code
block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name (format "
(%s)" name) ""))) (if (member "none" result-params) (progn (funcall cmd body
params) (message "result silenced")) (setq result (let ((r ...)) (if (and ...
... ...) (list ...) r))) (let ((file (and ... ...))) (if file (progn (if ...
...) (setq result file))) (let ((post ...)) (if post (progn ...)))
(org-babel-insert-result result result-params info new-hash lang))) (run-hooks
'org-babel-after-execute-hook) result)))
(let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params))))
(and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash
info :eval))) (old-hash (and cache (org-babel-current-result-hash)))
(current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache
(save-excursion (goto-char (org-babel-where-is-src-block-result nil info))
(forward-line) (skip-chars-forward " \11") (let ((result
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format
"%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0
info)) (result-params (cdr (assq :result-params params))) (body (let (... ...)
(if ... expand ...))) (dir (cdr (assq :dir params))) (mkdirp (cdr (assq :mkdirp
params))) (default-directory (cond (... default-directory) (... ...) (t ...)))
(cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp cmd) nil
(error "No org-babel-execute function for %s!" lang)) (message "executing %s
code block%s..." (capitalize lang) (let ((name ...)) (if name (format " (%s)"
name) ""))) (if (member "none" result-params) (progn (funcall cmd body params)
(message "result silenced")) (setq result (let (...) (if ... ... r))) (let
((file ...)) (if file (progn ... ...)) (let (...) (if post ...))
(org-babel-insert-result result result-params info new-hash lang))) (run-hooks
'org-babel-after-execute-hook) result))))
(progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car
c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr ...))) (and (not arg) c
(string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash info :eval)))
(old-hash (and cache (org-babel-current-result-hash))) (current-cache (and
new-hash (equal new-hash old-hash)))) (cond (current-cache (save-excursion
(goto-char (org-babel-where-is-src-block-result nil info)) (forward-line)
(skip-chars-forward " \11") (let ((result ...)) (message
(replace-regexp-in-string "%" "%%" ...)) result))) ((org-babel-confirm-evaluate
info) (let* ((lang (nth 0 info)) (result-params (cdr ...)) (body (let ... ...))
(dir (cdr ...)) (mkdirp (cdr ...)) (default-directory (cond ... ... ...)) (cmd
(intern ...)) result) (if (fboundp cmd) nil (error "No org-babel-execute
function for %s!" lang)) (message "executing %s code block%s..." (capitalize
lang) (let (...) (if name ... ""))) (if (member "none" result-params) (progn
(funcall cmd body params) (message "result silenced")) (setq result (let ...
...)) (let (...) (if file ...) (let ... ...) (org-babel-insert-result result
result-params info new-hash lang))) (run-hooks 'org-babel-after-execute-hook)
result)))))
(if (org-babel-check-evaluate info) (progn (let* ((c (nthcdr 2 info)))
(setcar c (org-babel-process-params (car c)))) (let* ((params (nth 2 info))
(cache (let ((c ...)) (and (not arg) c (string= "yes" c)))) (new-hash (and
cache (org-babel-sha1-hash info :eval))) (old-hash (and cache
(org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash
old-hash)))) (cond (current-cache (save-excursion (goto-char
(org-babel-where-is-src-block-result nil info)) (forward-line)
(skip-chars-forward " \11") (let (...) (message ...) result)))
((org-babel-confirm-evaluate info) (let* ((lang ...) (result-params ...) (body
...) (dir ...) (mkdirp ...) (default-directory ...) (cmd ...) result) (if
(fboundp cmd) nil (error "No org-babel-execute function for %s!" lang))
(message "executing %s code block%s..." (capitalize lang) (let ... ...)) (if
(member "none" result-params) (progn ... ...) (setq result ...) (let ... ...
... ...)) (run-hooks 'org-babel-after-execute-hook) result))))))
(let* ((org-babel-current-src-block-location (or
org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car
c)))) (let* ((params (nth 2 info)) (cache (let (...) (and ... c ...)))
(new-hash (and cache (org-babel-sha1-hash info :eval))) (old-hash (and cache
(org-babel-current-result-hash))) (current-cache (and new-hash (equal new-hash
old-hash)))) (cond (current-cache (save-excursion (goto-char ...)
(forward-line) (skip-chars-forward " \11") (let ... ... result)))
((org-babel-confirm-evaluate info) (let* (... ... ... ... ... ... ... result)
(if ... nil ...) (message "executing %s code block%s..." ... ...) (if ... ...
... ...) (run-hooks ...) result)))))))
(closure (*this* org-babel-confirm-evaluate-answer-no
org-babel-tangle-uncomment-comments org-src-preserve-indentation
org-src-lang-modes org-edit-src-content-indentation org-babel-library-of-babel
t) (&optional arg info params) "Execute the current source code block.\nInsert
the ..." (interactive) (let* ((org-babel-current-src-block-location (or
org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* ((c ...)) (setcar c (org-babel-process-params ...))) (let*
((params ...) (cache ...) (new-hash ...) (old-hash ...) (current-cache ...))
(cond (current-cache ...) (... ...)))))))(nil ("clojure" "(print \"hello,
world\")" ((:colname-names) (:rowname-names) (:result-params "replace")
(:result-type . value) (:results . "replace") (:exports . "") (:eval . "yes")
(:noweb . "yes") (:show-process . "no") (:mkdirp . "yes") (:cache . "yes")
(:tangle . "no") (:hlines . "no") (:session . "none")) "" nil 552720
"(ref:%s)") nil)
apply((closure (*this* org-babel-confirm-evaluate-answer-no
org-babel-tangle-uncomment-comments org-src-preserve-indentation
org-src-lang-modes org-edit-src-content-indentation org-babel-library-of-babel
t) (&optional arg info params) "Execute the current source code block.\nInsert
the ..." (interactive) (let* ((org-babel-current-src-block-location (or
org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* ((c ...)) (setcar c (org-babel-process-params ...))) (let*
((params ...) (cache ...) (new-hash ...) (old-hash ...) (current-cache ...))
(cond (current-cache ...) (... ...))))))) (nil ("clojure" "(print \"hello,
world\")" ((:colname-names) (:rowname-names) (:result-params "replace")
(:result-type . value) (:results . "replace") (:exports . "") (:eval . "yes")
(:noweb . "yes") (:show-process . "no") (:mkdirp . "yes") (:cache . "yes")
(:tangle . "no") (:hlines . "no") (:session . "none")) "" nil 552720
"(ref:%s)") nil))
#f(advice-wrapper :after (closure (*this*
org-babel-confirm-evaluate-answer-no org-babel-tangle-uncomment-comments
org-src-preserve-indentation org-src-lang-modes
org-edit-src-content-indentation org-babel-library-of-babel t) (&optional arg
info params) "Execute the current source code block.\nInsert the results of
execution into the buffer. Source code\nexecution and the collection and
formatting of results can be\ncontrolled through a variety of header
arguments.\n\nWith prefix argument ARG, force re-execution even if an
existing\nresult cached in the buffer would otherwise have been
returned.\n\nOptionally supply a value for INFO in the form returned
by\n`org-babel-get-src-block-info'.\n\nOptionally supply a value for PARAMS
which will be merged with\nthe header arguments specified at the front of the
source code\nblock." (interactive) (let* ((org-babel-current-src-block-location
(or org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* ((c (nthcdr 2 info))) (setcar c (org-babel-process-params (car
c)))) (let* ((params (nth 2 info)) (cache (let ((c (cdr (assq :cache params))))
(and (not arg) c (string= "yes" c)))) (new-hash (and cache (org-babel-sha1-hash
info :eval))) (old-hash (and cache (org-babel-current-result-hash)))
(current-cache (and new-hash (equal new-hash old-hash)))) (cond (current-cache
(save-excursion (goto-char (org-babel-where-is-src-block-result nil info))
(forward-line) (skip-chars-forward " \11") (let ((result
(org-babel-read-result))) (message (replace-regexp-in-string "%" "%%" (format
"%S" result))) result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0
info)) (result-params (cdr (assq :result-params params))) (body (let ((coderef
(nth 6 info)) (expand (if (org-babel-noweb-p params :eval)
(org-babel-expand-noweb-references info) (nth 1 info)))) (if (not coderef)
expand (replace-regexp-in-string (org-src-coderef-regexp coderef) "" expand nil
nil 1)))) (dir (cdr (assq :dir params))) (mkdirp (cdr (assq :mkdirp params)))
(default-directory (cond ((not dir) default-directory) ((member mkdirp '("no"
"nil" nil)) (file-name-as-directory (expand-file-name dir))) (t (let ((d
(file-name-as-directory (expand-file-name dir)))) (make-directory d 'parents)
d)))) (cmd (intern (concat "org-babel-execute:" lang))) result) (if (fboundp
cmd) nil (error "No org-babel-execute function for %s!" lang)) (message
"executing %s code block%s..." (capitalize lang) (let ((name (nth 4 info))) (if
name (format " (%s)" name) ""))) (if (member "none" result-params) (progn
(funcall cmd body params) (message "result silenced")) (setq result (let ((r
(funcall cmd body params))) (if (and (eq (cdr (assq :result-type params))
'value) (or (member "vector" result-params) (member "table" result-params))
(not (listp r))) (list (list r)) r))) (let ((file (and (member "file"
result-params) (cdr (assq :file params))))) (if file (progn (if (and result
(not (or (member "link" result-params) (member "graphics" result-params))))
(progn (let ((temp-file file) (temp-buffer (generate-new-buffer " *temp
file*"))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer)
(insert (org-babel-format-result result (cdr (assq :sep params)))))
(save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file
nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (setq
result file))) (let ((post (cdr (assq :post params)))) (if post (progn (let
((*this* (if (not file) result (org-babel-result-to-file file (let ((desc (assq
:file-desc params))) (and desc (or (cdr desc) result))))))) (setq result
(org-babel-ref-resolve post)) (if file (progn (setq result-params (remove
"file" result-params)))))))) (org-babel-insert-result result result-params info
new-hash lang))) (run-hooks 'org-babel-after-execute-hook) result))))))))
my/org-redisplay-inline-images)(nil ("clojure" "(print \"hello, world\")"
((:colname-names) (:rowname-names) (:result-params "replace") (:result-type .
value) (:results . "replace") (:exports . "") (:eval . "yes") (:noweb . "yes")
(:show-process . "no") (:mkdirp . "yes") (:cache . "yes") (:tangle . "no")
(:hlines . "no") (:session . "none")) "" nil 552720 "(ref:%s)") nil)
ob-async-org-babel-execute-src-block(#f(advice-wrapper :after (closure
(*this* org-babel-confirm-evaluate-answer-no
org-babel-tangle-uncomment-comments org-src-preserve-indentation
org-src-lang-modes org-edit-src-content-indentation org-babel-library-of-babel
t) (&optional arg info params) "Execute the current source code block.\nInsert
the ..." (interactive) (let* ((org-babel-current-src-block-location (or
org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* (...) (setcar c ...)) (let* (... ... ... ... ...) (cond ...
...)))))) my/org-redisplay-inline-images) nil ("clojure" "(print \"hello,
world\")" ((:colname-names) (:rowname-names) (:result-params "replace")
(:result-type . value) (:results . "replace") (:exports . "") (:eval . "yes")
(:noweb . "yes") (:show-process . "no") (:mkdirp . "yes") (:cache . "yes")
(:tangle . "no") (:hlines . "no") (:session . "none")) "" nil 552720
"(ref:%s)"))
apply(ob-async-org-babel-execute-src-block #f(advice-wrapper :after (closure
(*this* org-babel-confirm-evaluate-answer-no
org-babel-tangle-uncomment-comments org-src-preserve-indentation
org-src-lang-modes org-edit-src-content-indentation org-babel-library-of-babel
t) (&optional arg info params) "Execute the current source code block.\nInsert
the ..." (interactive) (let* ((org-babel-current-src-block-location (or
org-babel-current-src-block-location (nth 5 info)
(org-babel-where-is-src-block-head))) (info (if info (copy-tree info)
(org-babel-get-src-block-info)))) (let* ((c (nthcdr 2 info))) (setcar c
(org-babel-merge-params (car c) params))) (if (org-babel-check-evaluate info)
(progn (let* (...) (setcar c ...)) (let* (... ... ... ... ...) (cond ...
...)))))) my/org-redisplay-inline-images) (nil ("clojure" "(print \"hello,
world\")" ((:colname-names) (:rowname-names) (:result-params "replace")
(:result-type . value) (:results . "replace") (:exports . "") (:eval . "yes")
(:noweb . "yes") (:show-process . "no") (:mkdirp . "yes") (:cache . "yes")
(:tangle . "no") (:hlines . "no") (:session . "none")) "" nil 552720
"(ref:%s)")))
org-babel-execute-src-block(nil ("clojure" "(print \"hello, world\")"
((:colname-names) (:rowname-names) (:result-params "replace") (:result-type .
value) (:results . "replace") (:exports . "") (:eval . "yes") (:noweb . "yes")
(:show-process . "no") (:mkdirp . "yes") (:cache . "yes") (:tangle . "no")
(:hlines . "no") (:session . "none")) "" nil 552720 "(ref:%s)"))
(if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer)
(org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info
nil context)))
(cond ((memq type '(src-block inline-src-block)) (if
org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer)
(org-babel-execute-src-block current-prefix-arg (org-babel-get-src-block-info
nil context)))) ((org-match-line "[ \11]*$") (or
(run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (user-error
(substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful..."))))
((memq type '(inline-babel-call babel-call)) (let ((info
(org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block
nil info))))) ((eq type 'clock) (org-clock-update-time-maybe)) ((eq type
'dynamic-block) (save-excursion (goto-char (org-element-property
:post-affiliated context)) (org-update-dblock))) ((eq type
'footnote-definition) (goto-char (org-element-property :post-affiliated
context)) (call-interactively 'org-footnote-action)) ((eq type
'footnote-reference) (call-interactively #'org-footnote-action)) ((memq type
'(inlinetask headline)) (save-excursion (goto-char (org-element-property :begin
context)) (call-interactively #'org-set-tags-command))) ((eq type 'item) (if
(or radio-list-p (and (boundp org-list-checkbox-radio-mode)
org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* ((box
(org-element-property :checkbox context)) (struct (org-element-property
:structure context)) (old-struct (copy-tree struct)) (parents
(org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct))
(orderedp (org-not-nil ...))) (org-list-set-checkbox (org-element-property
:begin context) struct (cond (... "[-]") (... "[ ]") (... nil) (... "[ ]") (t
"[X]"))) (org-list-struct-fix-ind struct parents 2)
(org-list-struct-fix-item-end struct) (org-list-struct-fix-bul struct prevs)
(org-list-struct-fix-ind struct parents) (let ((block-item ...)) (if (and box
...) (if ... ... ...) (org-list-struct-apply-struct struct old-struct)
(org-update-checkbox-count-maybe)) (if block-item (progn ...)))))) ((eq type
'plain-list) (if (or radio-list-p (and (boundp org-list-checkbox-radio-mode)
org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* ((begin
(org-element-property :contents-begin context)) (struct (org-element-property
:structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion
... ... ...)) (new-box (cond ... ... ... ...))) (cond (arg (let ... ...)) ((and
first-box ...) (org-list-set-checkbox begin struct new-box))) (if (equal
(org-list-write-struct struct ... old-struct) old-struct) (progn (message
"Cannot update this checkbox"))) (org-update-checkbox-count-maybe)))) ((eq type
'keyword) (let ((org-inhibit-startup-visibility-stuff t)
(org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays)
(progn (mapc #'delete-overlay org-table-coordinate-overlays) (setq
org-table-coordinate-overlays nil))) (let* ((--invisible-types '...)
(--markers\? 'use-markers) (--data (mapcar ... ...))) (unwind-protect (progn
(org-mode-restart)) (save-excursion (save-restriction ... ... ...))))) (message
"Local setup has been refreshed")) ((memq type '(node-property
property-drawer)) (call-interactively #'org-property-action)) ((eq type
'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type
'statistics-cookie) (call-interactively #'org-update-statistics-cookies))
((memq type '(table-row table-cell table)) (if (eq (org-element-property :type
context) 'table\.el) (message "%s" (substitute-command-keys
"\\<org-mode-map>Use `\\[org-edit-special]' to ...")) (if (or (eq type 'table)
(and (eq type ...) (= ... ...))) (save-excursion (if (org-at-TBLFM-p) (progn
... ...) (goto-char ...) (org-call-with-arg ... ...) (orgtbl-send-table ...)))
(org-table-maybe-eval-formula) (cond (arg (call-interactively ...))
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p
'lax) (funcall pcase-0)) ((run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful..."))))) ((null type) (cond
((org-at-heading-p) (call-interactively #'org-set-tags-command))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall
pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2)))
(let* ((pcase-2 #'(lambda nil (user-error (substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) (pcase-1 #'(lambda
nil)) (pcase-0 #'(lambda nil (org-timestamp-change 0 'day)))) (cond ((memq type
'(src-block inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block
current-prefix-arg (org-babel-get-src-block-info nil context))))
((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context)))
(if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock)
(org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion
(goto-char (org-element-property :post-affiliated context))
(org-update-dblock))) ((eq type 'footnote-definition) (goto-char
(org-element-property :post-affiliated context)) (call-interactively
'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively
#'org-footnote-action)) ((memq type '(inlinetask headline)) (save-excursion
(goto-char (org-element-property :begin context)) (call-interactively
#'org-set-tags-command))) ((eq type 'item) (if (or radio-list-p (and (boundp
org-list-checkbox-radio-mode) org-list-checkbox-radio-mode))
(org-toggle-radio-button arg) (let* ((box (org-element-property :checkbox
context)) (struct (org-element-property :structure context)) (old-struct
(copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs
(org-list-prevs-alist struct)) (orderedp (org-not-nil ...)))
(org-list-set-checkbox (org-element-property :begin context) struct (cond (...
"[-]") (... "[ ]") (... nil) (... "[ ]") (t "[X]"))) (org-list-struct-fix-ind
struct parents 2) (org-list-struct-fix-item-end struct)
(org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct parents)
(let ((block-item ...)) (if (and box ...) (if ... ... ...)
(org-list-struct-apply-struct struct old-struct)
(org-update-checkbox-count-maybe)) (if block-item (progn ...)))))) ((eq type
'plain-list) (if (or radio-list-p (and (boundp org-list-checkbox-radio-mode)
org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* ((begin
(org-element-property :contents-begin context)) (struct (org-element-property
:structure context)) (old-struct (copy-tree struct)) (first-box (save-excursion
... ... ...)) (new-box (cond ... ... ... ...))) (cond (arg (let ... ...)) ((and
first-box ...) (org-list-set-checkbox begin struct new-box))) (if (equal
(org-list-write-struct struct ... old-struct) old-struct) (progn (message
"Cannot update this checkbox"))) (org-update-checkbox-count-maybe)))) ((eq type
'keyword) (let ((org-inhibit-startup-visibility-stuff t)
(org-startup-align-all-tables nil)) (if (boundp 'org-table-coordinate-overlays)
(progn (mapc #'delete-overlay org-table-coordinate-overlays) (setq
org-table-coordinate-overlays nil))) (let* ((--invisible-types '...)
(--markers\? 'use-markers) (--data (mapcar ... ...))) (unwind-protect (progn
(org-mode-restart)) (save-excursion (save-restriction ... ... ...))))) (message
"Local setup has been refreshed")) ((memq type '(node-property
property-drawer)) (call-interactively #'org-property-action)) ((eq type
'radio-target) (call-interactively #'org-update-radio-target-regexp)) ((eq type
'statistics-cookie) (call-interactively #'org-update-statistics-cookies))
((memq type '(table-row table-cell table)) (if (eq (org-element-property :type
context) 'table\.el) (message "%s" (substitute-command-keys
"\\<org-mode-map>Use `\\[org-edit-special]' to edit t...")) (if (or (eq type
'table) (and (eq type ...) (= ... ...))) (save-excursion (if (org-at-TBLFM-p)
(progn ... ...) (goto-char ...) (org-call-with-arg ... ...) (orgtbl-send-table
...))) (org-table-maybe-eval-formula) (cond (arg (call-interactively ...))
((org-table-maybe-recalculate-line)) (t (org-table-align)))))) ((eq type
'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond ((org-at-timestamp-p
'lax) (funcall pcase-0)) ((run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) nil) (t (user-error (substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) ((null type) (cond
((org-at-heading-p) (call-interactively #'org-set-tags-command))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall
pcase-1)) (t (funcall pcase-2)))) ((run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2))))
(let* ((context (org-element-lineage (org-element-context) '(babel-call clock
dynamic-block footnote-definition footnote-reference inline-babel-call
inline-src-block inlinetask item keyword node-property paragraph plain-list
planning property-drawer radio-target src-block statistics-cookie table
table-cell table-row timestamp) t)) (radio-list-p (org-at-radio-list-p)) (type
(org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent
(org-element-property :parent context))) (if (and (eq (org-element-type parent)
'item) (= (line-beginning-position) (org-element-property :begin parent)))
(progn (setq context parent) (setq type 'item)))))) (let* ((pcase-2 #'(lambda
nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do
nothing useful here")))) (pcase-1 #'(lambda nil)) (pcase-0 #'(lambda nil
(org-timestamp-change 0 'day)))) (cond ((memq type '(src-block
inline-src-block)) (if org-babel-no-eval-on-ctrl-c-ctrl-c nil
(org-babel-eval-wipe-error-buffer) (org-babel-execute-src-block
current-prefix-arg (org-babel-get-src-block-info nil context))))
((org-match-line "[ \11]*$") (or (run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) (user-error (substitute-command-keys
"`\\[org-ctrl-c-ctrl-c]' can do nothing useful here")))) ((memq type
'(inline-babel-call babel-call)) (let ((info (org-babel-lob-get-info context)))
(if info (progn (org-babel-execute-src-block nil info))))) ((eq type 'clock)
(org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion
(goto-char (org-element-property :post-affiliated context))
(org-update-dblock))) ((eq type 'footnote-definition) (goto-char
(org-element-property :post-affiliated context)) (call-interactively
'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively
#'org-footnote-action)) ((memq type '(inlinetask headline)) (save-excursion
(goto-char (org-element-property :begin context)) (call-interactively
#'org-set-tags-command))) ((eq type 'item) (if (or radio-list-p (and (boundp
org-list-checkbox-radio-mode) org-list-checkbox-radio-mode))
(org-toggle-radio-button arg) (let* ((box ...) (struct ...) (old-struct ...)
(parents ...) (prevs ...) (orderedp ...)) (org-list-set-checkbox
(org-element-property :begin context) struct (cond ... ... ... ... ...))
(org-list-struct-fix-ind struct parents 2) (org-list-struct-fix-item-end
struct) (org-list-struct-fix-bul struct prevs) (org-list-struct-fix-ind struct
parents) (let (...) (if ... ... ... ...) (if block-item ...))))) ((eq type
'plain-list) (if (or radio-list-p (and (boundp org-list-checkbox-radio-mode)
org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* ((begin ...)
(struct ...) (old-struct ...) (first-box ...) (new-box ...)) (cond (arg ...)
(... ...)) (if (equal ... old-struct) (progn ...))
(org-update-checkbox-count-maybe)))) ((eq type 'keyword) (let
((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil))
(if (boundp 'org-table-coordinate-overlays) (progn (mapc ...
org-table-coordinate-overlays) (setq org-table-coordinate-overlays nil))) (let*
((--invisible-types ...) (--markers\? ...) (--data ...)) (unwind-protect (progn
...) (save-excursion ...)))) (message "Local setup has been refreshed")) ((memq
type '(node-property property-drawer)) (call-interactively
#'org-property-action)) ((eq type 'radio-target) (call-interactively
#'org-update-radio-target-regexp)) ((eq type 'statistics-cookie)
(call-interactively #'org-update-statistics-cookies)) ((memq type '(table-row
table-cell table)) (if (eq (org-element-property :type context) 'table\.el)
(message "%s" (substitute-command-keys "\\<org-mode-map>Use
`\\[org-edit-special]' to edit t...")) (if (or (eq type ...) (and ... ...))
(save-excursion (if ... ... ... ... ...)) (org-table-maybe-eval-formula) (cond
(arg ...) (...) (t ...))))) ((eq type 'timestamp) (funcall pcase-0)) ((eq type
'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-0))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) nil) (t
(user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing
useful here"))))) ((null type) (cond ((org-at-heading-p) (call-interactively
#'org-set-tags-command)) ((run-hook-with-args-until-success
'org-ctrl-c-ctrl-c-final-hook) (funcall pcase-1)) (t (funcall pcase-2))))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall
pcase-1)) (t (funcall pcase-2)))))
(cond ((and (boundp 'org-columns-overlays) org-columns-overlays)
(org-columns-quit)) ((or (and (boundp 'org-clock-overlays) org-clock-overlays)
org-occur-highlights) (if (boundp 'org-clock-overlays) (progn
(org-clock-remove-overlays))) (org-remove-occur-highlights) (message "Temporary
highlights/overlays removed from current...")) ((and (local-variable-p
'org-finish-function) (fboundp org-finish-function)) (funcall
org-finish-function)) ((org-babel-hash-at-point))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) (t (let* ((context
(org-element-lineage (org-element-context) '(babel-call clock dynamic-block
footnote-definition footnote-reference inline-babel-call inline-src-block
inlinetask item keyword node-property paragraph plain-list planning
property-drawer radio-target src-block statistics-cookie table table-cell
table-row timestamp) t)) (radio-list-p (org-at-radio-list-p)) (type
(org-element-type context))) (if (eq type 'paragraph) (progn (let ((parent
...)) (if (and ... ...) (progn ... ...))))) (let* ((pcase-2 #'(lambda nil ...))
(pcase-1 #'(lambda nil)) (pcase-0 #'(lambda nil ...))) (cond ((memq type '...)
(if org-babel-no-eval-on-ctrl-c-ctrl-c nil (org-babel-eval-wipe-error-buffer)
(org-babel-execute-src-block current-prefix-arg ...))) ((org-match-line "[
\11]*$") (or (run-hook-with-args-until-success ...) (user-error ...))) ((memq
type '...) (let (...) (if info ...))) ((eq type 'clock)
(org-clock-update-time-maybe)) ((eq type 'dynamic-block) (save-excursion
(goto-char ...) (org-update-dblock))) ((eq type 'footnote-definition)
(goto-char (org-element-property :post-affiliated context)) (call-interactively
'org-footnote-action)) ((eq type 'footnote-reference) (call-interactively
#'org-footnote-action)) ((memq type '...) (save-excursion (goto-char ...)
(call-interactively ...))) ((eq type 'item) (if (or radio-list-p ...)
(org-toggle-radio-button arg) (let* ... ... ... ... ... ... ...))) ((eq type
'plain-list) (if (or radio-list-p ...) (org-toggle-radio-button arg) (let* ...
... ... ...))) ((eq type 'keyword) (let (... ...) (if ... ...) (let* ... ...))
(message "Local setup has been refreshed")) ((memq type '...)
(call-interactively #'org-property-action)) ((eq type 'radio-target)
(call-interactively #'org-update-radio-target-regexp)) ((eq type
'statistics-cookie) (call-interactively #'org-update-statistics-cookies))
((memq type '...) (if (eq ... ...) (message "%s" ...) (if ... ... ... ...)))
((eq type 'timestamp) (funcall pcase-0)) ((eq type 'planning) (cond (... ...)
(... nil) (t ...))) ((null type) (cond (... ...) (... ...) (t ...)))
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (funcall
pcase-1)) (t (funcall pcase-2)))))))
org-ctrl-c-ctrl-c(nil)
funcall-interactively(org-ctrl-c-ctrl-c nil)
call-interactively(org-ctrl-c-ctrl-c nil nil)
command-execute(org-ctrl-c-ctrl-c)
#+end_example
Then I take a check, found that the latest version inf-clojure seems don't have
~inf-clojure-cmd~, ~inf-clojure-project-type~ functions.
Am I wrong on searching? Comparing the new backend implement timestamp and
inf-clojure commits history timestamp, Bastien will not add a function which is
already remove. So I did Git log search, those functions are indeed remove.
>
> Inf-clojure is more lightweight than cider.
>
> Also, with (setq org-babel-clojure-backend 'inf-clojure) you can now
> add a :alias header arg to the src block and "clojure -Aalias" will
> then be called to launch the repl.
>
>> While I love CIDER, I'm not sure it is the right tool for a org-babel
>> type environment. I've recently been moving my projects from being lein
>> based to Clojure CLI tools based and while I still use CIDER for larger
>> development work, find the CLI great for basic execution of code. For
>> me, CIDER has a lot of additional overhead and complexity which is often
>> of little benefit to what I want via babel and I've found it to be a
>> very fragile environment.
>
> Yep, I agree again.
>
>> Sean Corfield has a great example deps.edn file at
>> https://github.com/seancorfield/doc-clojure and it shows how you can
>> hook in various different REPLs - for example, a basic socket based
>> REPL, which might provide a cleaner and more stable back end interface
>> for evaluating Clojure (and potentially clojurescript) for babel.
>
> I am not sure it is worth getting rid of inf-clojure.el altogether,
> but relying on tools.deps seems the way to go.
>
>> As I said, this is an initial and immature idea, but I think it could
>> provide a back end which was a little more like other babel back ends
>> and may be less fragile than one based on CIDER (plus I suspect it would
>> be faster). What do people think? Is this something worth investigating
>> further?
>
> Definitely! Thanks for sharing these idea.
>
> Please try the latest ob-clojure.el from master and let me know what
> can be improved to better fit your (and others') needs.
>
> Thanks,
- --
[ stardiviner ]
I try to make every word tell the meaning that I want to express.
Blog: https://stardiviner.github.io/
IRC(freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----
iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl6n95YUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsNoqwf6Ap4NBd5DnbLgYgamIgD4QhSLwl9Y
kMpAu/Drlixtu5+GOhkC49WfobavgxK9K0on+a+Jg3NTdeS4qRpmTq/E4YS2zF0D
74oHwADfuQ76ykv2klnvpQY4j0+3lyc9sfP/6e03ZpL91kUgRqEdGh80MbZd4u2J
Y0vVAzTnLIf1IOVE3EX4kOTO9+WKG4xPFG3M9W13ZzkzWv/09Qjk39PQIns+ijqv
46sKLaswJRZ5X5yYKhE3/Z4KnOHoJFnEI5vtF0B4JU8dyn667WO1aG2zqbdKs+I1
89ZgjSOYrB7Op81YPUXQjFQ6eOVHImoxN83lrp3qZ+CEOf8pkvXOVU0low==
=nieg
-----END PGP SIGNATURE-----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [BUG] ob-clojure.el new backend 'inf-clojure not compatible with latest version inf-clojure,
stardiviner <=