diff --git a/Makefile b/Makefile index af35fd0..1497461 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ test: (setq org-confirm-babel-evaluate nil) \ (org-babel-do-load-languages \ 'org-babel-load-languages '((emacs-lisp . t) \ - (sh . t) \ + (shell . t) \ (org . t) \ (hy . t))))" \ -f ob-hy-test-runall diff --git a/ob-hy.el b/ob-hy.el index 46d2027..820e053 100644 --- a/ob-hy.el +++ b/ob-hy.el @@ -142,18 +142,22 @@ last statement in BODY, as elisp." (let ((result (pcase result-type (`output (org-babel-eval - (format "%s -c '%s'" org-babel-hy-command body) "")) + (format "%s -c %s" + org-babel-hy-command + (combine-and-quote-strings (list body))) "")) (`value (let ((tmp-file (org-babel-temp-file "hy-"))) (org-babel-eval (format - "%s -c '%s'" + "%s -c %s" org-babel-hy-command - (format - (if (member "pp" result-params) - org-babel-hy-pp-wrapper-method - org-babel-hy-wrapper-method) - body - (org-babel-process-file-name tmp-file 'noquote))) "") + (combine-and-quote-strings + (list + (format + (if (member "pp" result-params) + org-babel-hy-pp-wrapper-method + org-babel-hy-wrapper-method) + body + (org-babel-process-file-name tmp-file 'noquote))))) "") (org-babel-eval-read-file tmp-file)))))) (org-babel-result-cond result-params result @@ -176,9 +180,9 @@ last statement in BODY, as elisp." (if pp (list "(import pprint)" - (format "(with [f (open \"%s\" \"w\")] (.write f (.pformat pprint _)))" + (format "(with [f (open \"%s\" \"w\")] (.write f (.pformat pprint *1)))" (org-babel-process-file-name tmp-file 'noquote))) - (list (format "(with [f (open \"%s\" \"w\")] (.write f (str _)))" + (list (format "(with [f (open \"%s\" \"w\")] (.write f (str *1)))" (org-babel-process-file-name tmp-file 'noquote))))))) (input-body (lambda (body) (mapc @@ -328,13 +332,12 @@ then create. Return the initialized session." (error "No function available for running an inferior Hy")) (save-window-excursion (let* ((session (if session (intern session) :default)) - (hy-buffer (org-babel-hy-session-buffer session)) - (cmd org-babel-hy-command)) + (hy-buffer (org-babel-hy-session-buffer session))) (unless hy-buffer (setq hy-buffer (org-babel-hy-with-earmuffs session))) (let ((hy-shell-buffer-name (org-babel-hy-without-earmuffs hy-buffer))) - (run-hy cmd)) + (run-hy)) (setq org-babel-hy-buffers (cons (cons session hy-buffer) (assq-delete-all session org-babel-hy-buffers)))