emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ob-clojure eval error when has comment at end of code line
@ 2021-11-11  4:08 Christopher M. Miles
  2022-10-26  7:30 ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Christopher M. Miles @ 2021-11-11  4:08 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 33560 bytes --]


I have following Clojure source block:

#+begin_src clojure
(re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451"
(re-find #"Bees" "Beads aren't cheap.");; => nil
#+end_src

When I press =[C-c C-c]= to evaluate source block, got error:

When there is no comments behind code lines. No this error.

#+begin_example
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("nil" "" nil)
  (closure ((result0 "nil" nil "nil" "\"451\"" nil "\"451\"") (result-params "replace") (connection . #<buffer *cider-repl Manuals/My Clojure Language Syntax Reference:localhost:55604(clj)*>) (params (: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")) (expanded . "(re-find #\"\\d+\" \"I've just finished reading Fahren...") inf-clojure-comint-prompt-regexp inf-clojure-buffer ob-clojure-inf-clojure-tmp-output ob-clojure-inf-clojure-filter-out t) (r) (replace-regexp-in-string "nil" "" r))(nil)
  mapcar((closure ((result0 "nil" nil "nil" "\"451\"" nil "\"451\"") (result-params "replace") (connection . #<buffer *cider-repl Manuals/My Clojure Language Syntax Reference:localhost:55604(clj)*>) (params (: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")) (expanded . "(re-find #\"\\d+\" \"I've just finished reading Fahren...") inf-clojure-comint-prompt-regexp inf-clojure-buffer ob-clojure-inf-clojure-tmp-output ob-clojure-inf-clojure-filter-out t) (r) (replace-regexp-in-string "nil" "" r)) ("nil" nil "nil" "\"451\"" nil "\"451\""))
  (delete "" (mapcar #'(lambda (r) (replace-regexp-in-string "nil" "" r)) result0))
  (reverse (delete "" (mapcar #'(lambda (r) (replace-regexp-in-string "nil" "" r)) result0)))
  (ob-clojure-string-or-list (reverse (delete "" (mapcar #'(lambda (r) (replace-regexp-in-string "nil" "" r)) result0))))
  (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" "" r)) result0)))))
  (let ((connection (cider-current-connection (cdr (assq :target params)))) (result-params (cdr (assq :result-params params))) result0) (if connection nil (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 ...) (let* ... ... ...))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (ob-clojure-string-or-list (reverse (delete "" (mapcar #'(lambda ... ...) result0))))))
  ob-clojure-eval-with-cider("(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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("(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 "(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 ... ...)) (if (assq :file-mode params) (progn ...)))) (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 (org-babel--expand-body info)) (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 ... ...) (if ... ...))) (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 (org-babel--expand-body info)) (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 (org-babel--expand-body info)) (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 (org-babel--expand-body info)) (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" "(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 100164 "(ref:%s)") nil)
  ob-async-org-babel-execute-src-block((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" "(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 100164 "(ref:%s)"))
  apply(ob-async-org-babel-execute-src-block (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" "(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 100164 "(ref:%s)")))
  org-babel-execute-src-block(nil ("clojure" "(re-find #\"\\d+\" \"I've just finished reading Fahren..." ((: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 100164 "(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)))
  (let nil (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)) (let nil (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]*$") (let nil (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 nil (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info)))))) ((eq type 'clock) (let nil (org-clock-update-time-maybe))) ((eq type 'dynamic-block) (let nil (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock)))) ((eq type 'footnote-definition) (let nil (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action))) ((eq type 'footnote-reference) (let nil (call-interactively #'org-footnote-action))) ((memq type '(inlinetask headline)) (let nil (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command)))) ((eq type 'item) (let nil (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) (let nil (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 nil (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)) (let nil (call-interactively #'org-property-action))) ((eq type 'radio-target) (let nil (call-interactively #'org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (let nil (call-interactively #'org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (let nil (cond ((and (org-match-line "[ \11]*#\\+plot:") (< (point) (org-element-property :post-affiliated context))) (org-plot/gnuplot)) ((eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit t..."))) ((or (eq type 'table) (and (eq type ...) (= ... ...))) (save-excursion (if (org-at-TBLFM-p) (progn ... ...) (goto-char ...) (org-call-with-arg ... ...) (orgtbl-send-table ...)))) (t (org-table-maybe-eval-formula) (cond (arg (call-interactively ...)) ((org-table-maybe-recalculate-line)) (t (org-table-align))))))) ((eq type 'timestamp) (funcall pcase-1)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-1)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((null type) (cond ((org-at-heading-p) (let nil (call-interactively #'org-set-tags-command))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))
  (let* ((pcase-1 #'(lambda nil (org-timestamp-change 0 'day))) (pcase-0 #'(lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (cond ((memq type '(src-block inline-src-block)) (let nil (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]*$") (let nil (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 nil (let ((info (org-babel-lob-get-info context))) (if info (progn (org-babel-execute-src-block nil info)))))) ((eq type 'clock) (let nil (org-clock-update-time-maybe))) ((eq type 'dynamic-block) (let nil (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock)))) ((eq type 'footnote-definition) (let nil (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action))) ((eq type 'footnote-reference) (let nil (call-interactively #'org-footnote-action))) ((memq type '(inlinetask headline)) (let nil (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command)))) ((eq type 'item) (let nil (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) (let nil (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 nil (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)) (let nil (call-interactively #'org-property-action))) ((eq type 'radio-target) (let nil (call-interactively #'org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (let nil (call-interactively #'org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (let nil (cond ((and (org-match-line "[ \11]*#\\+plot:") (< ... ...)) (org-plot/gnuplot)) ((eq (org-element-property :type context) 'table\.el) (message "%s" (substitute-command-keys "\\<org-mode-map>Use `\\[org-edit-special]' to edit t..."))) ((or (eq type ...) (and ... ...)) (save-excursion (if ... ... ... ... ...))) (t (org-table-maybe-eval-formula) (cond (arg ...) (...) (t ...)))))) ((eq type 'timestamp) (funcall pcase-1)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-1)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((null type) (cond ((org-at-heading-p) (let nil (call-interactively #'org-set-tags-command))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0))))
  (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-1 #'(lambda nil (org-timestamp-change 0 'day))) (pcase-0 #'(lambda nil (user-error (substitute-command-keys "`\\[org-ctrl-c-ctrl-c]' can do nothing useful here"))))) (cond ((memq type '(src-block inline-src-block)) (let nil (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]*$") (let nil (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 nil (let ((info ...)) (if info (progn ...))))) ((eq type 'clock) (let nil (org-clock-update-time-maybe))) ((eq type 'dynamic-block) (let nil (save-excursion (goto-char (org-element-property :post-affiliated context)) (org-update-dblock)))) ((eq type 'footnote-definition) (let nil (goto-char (org-element-property :post-affiliated context)) (call-interactively 'org-footnote-action))) ((eq type 'footnote-reference) (let nil (call-interactively #'org-footnote-action))) ((memq type '(inlinetask headline)) (let nil (save-excursion (goto-char (org-element-property :begin context)) (call-interactively #'org-set-tags-command)))) ((eq type 'item) (let nil (if (or radio-list-p (and ... org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* (... ... ... ... ... ...) (org-list-set-checkbox ... struct ...) (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 ... ... ...))))) ((eq type 'plain-list) (let nil (if (or radio-list-p (and ... org-list-checkbox-radio-mode)) (org-toggle-radio-button arg) (let* (... ... ... ... ...) (cond ... ...) (if ... ...) (org-update-checkbox-count-maybe))))) ((eq type 'keyword) (let nil (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (if (boundp ...) (progn ... ...)) (let* (... ... ...) (unwind-protect ... ...))) (message "Local setup has been refreshed"))) ((memq type '(node-property property-drawer)) (let nil (call-interactively #'org-property-action))) ((eq type 'radio-target) (let nil (call-interactively #'org-update-radio-target-regexp))) ((eq type 'statistics-cookie) (let nil (call-interactively #'org-update-statistics-cookies))) ((memq type '(table-row table-cell table)) (let nil (cond ((and ... ...) (org-plot/gnuplot)) ((eq ... ...) (message "%s" ...)) ((or ... ...) (save-excursion ...)) (t (org-table-maybe-eval-formula) (cond ... ... ...))))) ((eq type 'timestamp) (funcall pcase-1)) ((eq type 'planning) (cond ((org-at-timestamp-p 'lax) (funcall pcase-1)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((null type) (cond ((org-at-heading-p) (let nil (call-interactively ...))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))))
  (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-1 #'(lambda nil ...)) (pcase-0 #'(lambda nil ...))) (cond ((memq type '...) (let nil (if org-babel-no-eval-on-ctrl-c-ctrl-c nil ... ...))) ((org-match-line "[ \11]*$") (let nil (or ... ...))) ((memq type '...) (let nil (let ... ...))) ((eq type 'clock) (let nil (org-clock-update-time-maybe))) ((eq type 'dynamic-block) (let nil (save-excursion ... ...))) ((eq type 'footnote-definition) (let nil (goto-char ...) (call-interactively ...))) ((eq type 'footnote-reference) (let nil (call-interactively ...))) ((memq type '...) (let nil (save-excursion ... ...))) ((eq type 'item) (let nil (if ... ... ...))) ((eq type 'plain-list) (let nil (if ... ... ...))) ((eq type 'keyword) (let nil (let ... ... ...) (message "Local setup has been refreshed"))) ((memq type '...) (let nil (call-interactively ...))) ((eq type 'radio-target) (let nil (call-interactively ...))) ((eq type 'statistics-cookie) (let nil (call-interactively ...))) ((memq type '...) (let nil (cond ... ... ... ...))) ((eq type 'timestamp) (funcall pcase-1)) ((eq type 'planning) (cond (... ...) (... ...) (t ...))) ((null type) (cond (... ...) (... ...) (t ...))) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) 'nil) (t (funcall pcase-0)))))))
  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

-- 
[ 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure eval error when has comment at end of code line
  2021-11-11  4:08 ob-clojure eval error when has comment at end of code line Christopher M. Miles
@ 2022-10-26  7:30 ` Ihor Radchenko
  2022-10-27 12:25   ` Daniel Kraus
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2022-10-26  7:30 UTC (permalink / raw)
  To: numbchild, Daniel Kraus; +Cc: Org Mode

"Christopher M. Miles" <numbchild@gmail.com> writes:

> I have following Clojure source block:
>
> #+begin_src clojure
> (re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451"
> (re-find #"Bees" "Beads aren't cheap.");; => nil
> #+end_src
>
> When I press =[C-c C-c]= to evaluate source block, got error:
>
> When there is no comments behind code lines. No this error.
>
> #+begin_example
> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>   replace-regexp-in-string("nil" "" nil)

Daniel, could you please take a look?

-- 
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>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure eval error when has comment at end of code line
  2022-10-26  7:30 ` Ihor Radchenko
@ 2022-10-27 12:25   ` Daniel Kraus
  2022-10-27 14:17     ` Max Nikulin
  2022-10-28  4:05     ` Ihor Radchenko
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Kraus @ 2022-10-27 12:25 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: numbchild, Org Mode

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

Hi!

I had a look and apparently cider-eval returns nil when the expression
is a comment, vs the string "nil" when the Clojure expression returns nil.
Simply filtering nil values out seems to have fixed the issue
for me.
@Christopher, can you check the attached patch if this works for you?

@Ihor, a few developer related questions:
- I wanted to add a test, how can I run only test-ob-clojure?
  I don't think the tests work currently and I would fix them and add more.
- What should I use for indention? Looking in ob-clojure and org.el
  it seems that using tabs with tab-width 8 is standard but there's
  quite a few lines where it's spaces only.
- If this simple patch for example or fixing tests is good,
  should I just install it?
  Can I "freely" install minor changes to ob-clojure or should
  everything go over the mailinglist?

Thanks. I hope I can work a bit more on ob-clojure the next few days,
I think I missed a few emails, sorry. Now I have a filter rule where
mails with Clojure in the subject go to my inbox.

Cheers,
  Daniel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ob-clojure.el-Fix-bug-with-inline-comments.patch --]
[-- Type: text/x-patch, Size: 882 bytes --]

From 87054023df0876d17771ee3885e7b1091ccdeab1 Mon Sep 17 00:00:00 2001
From: Daniel Kraus <daniel@kraus.my>
Date: Thu, 27 Oct 2022 14:16:33 +0200
Subject: [PATCH] lisp/ob-clojure.el: Fix bug with inline comments

* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out
  nil values from cider evaluation.
---
 lisp/ob-clojure.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 0649469b3..eff8d04e4 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -239,7 +239,7 @@ or set the `:backend' header argument"))))
 		result0)))
       (ob-clojure-string-or-list
        (reverse (delete "" (mapcar (lambda (r)
-				     (replace-regexp-in-string "nil" "" r))
+				     (replace-regexp-in-string "nil" "" (or r "")))
 				   result0)))))))
 
 (defun ob-clojure-eval-with-slime (expanded params)
-- 
2.38.1


[-- Attachment #3: Type: text/plain, Size: 620 bytes --]


Ihor Radchenko <yantar92@posteo.net> writes:

> "Christopher M. Miles" <numbchild@gmail.com> writes:
>
>> I have following Clojure source block:
>>
>> #+begin_src clojure
>> (re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451"
>> (re-find #"Bees" "Beads aren't cheap.");; => nil
>> #+end_src
>>
>> When I press =[C-c C-c]= to evaluate source block, got error:
>>
>> When there is no comments behind code lines. No this error.
>>
>> #+begin_example
>> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>>   replace-regexp-in-string("nil" "" nil)
>
> Daniel, could you please take a look?

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: ob-clojure eval error when has comment at end of code line
  2022-10-27 12:25   ` Daniel Kraus
@ 2022-10-27 14:17     ` Max Nikulin
  2022-10-28  4:05     ` Ihor Radchenko
  1 sibling, 0 replies; 13+ messages in thread
From: Max Nikulin @ 2022-10-27 14:17 UTC (permalink / raw)
  To: Daniel Kraus; +Cc: Org Mode

On 27/10/2022 19:25, Daniel Kraus wrote:
> 
> - I wanted to add a test, how can I run only test-ob-clojure?

See testing/README

     make BTEST_RE=ob-closure



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure eval error when has comment at end of code line
  2022-10-27 12:25   ` Daniel Kraus
  2022-10-27 14:17     ` Max Nikulin
@ 2022-10-28  4:05     ` Ihor Radchenko
  2022-10-28  9:40       ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
  2022-10-29 20:13       ` indent-tabs-mode in org " Daniel Kraus
  1 sibling, 2 replies; 13+ messages in thread
From: Ihor Radchenko @ 2022-10-28  4:05 UTC (permalink / raw)
  To: Daniel Kraus, Bastien; +Cc: numbchild, Org Mode

Daniel Kraus <daniel@kraus.my> writes:

> @Ihor, a few developer related questions:
> - I wanted to add a test, how can I run only test-ob-clojure?

make test BTEST_POST="-L /path/to/cider.el" BTEST_OB_LANGUAGES="clojure" BTEST_RE="ob-clojure"

Note that our tests demand cider executable and library.
Testing with external libraries is a bit manual.

> - What should I use for indention? Looking in ob-clojure and org.el
>   it seems that using tabs with tab-width 8 is standard but there's
>   quite a few lines where it's spaces only.

That is a good question. I guess, just Emacs default.
Our code is not consistent here...
Maybe Bastien can clarify better.

> - If this simple patch for example or fixing tests is good,
>   should I just install it?

Yes. We have some conventions documented at
https://orgmode.org/worg/org-maintenance.html#maintainer-role

>   Can I "freely" install minor changes to ob-clojure or should
>   everything go over the mailinglist?

Minor changes do not need to be discussed. We generally discuss new
features or changes that affect multiple libraries.

-- 
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>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)
  2022-10-28  4:05     ` Ihor Radchenko
@ 2022-10-28  9:40       ` Daniel Kraus
  2022-10-28 10:20         ` ob-clojure session support Bastien Guerry
  2022-10-29  3:03         ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Ihor Radchenko
  2022-10-29 20:13       ` indent-tabs-mode in org " Daniel Kraus
  1 sibling, 2 replies; 13+ messages in thread
From: Daniel Kraus @ 2022-10-28  9:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, numbchild, emacs-orgmode


Ihor Radchenko <yantar92@posteo.net> writes:

> make test BTEST_POST="-L /path/to/cider.el" BTEST_OB_LANGUAGES="clojure" BTEST_RE="ob-clojure"
>
> Note that our tests demand cider executable and library.
> Testing with external libraries is a bit manual.

Thanks. I think cider is falsely required in the test.
It tests session support which I don't think ob-clojure has.

Looking in the history, Christopher added session support 5 years ago,
then (3 years ago) I see Bastien also adding something with initiate-session but
then removing all session support the following commit.
I guess something was broken and got removed but stayed in the test?

Does anyone remember what's the status of ob-clojure session support?

Cheers,
  Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure session support
  2022-10-28  9:40       ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
@ 2022-10-28 10:20         ` Bastien Guerry
  2022-10-29  3:03         ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Ihor Radchenko
  1 sibling, 0 replies; 13+ messages in thread
From: Bastien Guerry @ 2022-10-28 10:20 UTC (permalink / raw)
  To: Daniel Kraus; +Cc: Ihor Radchenko, numbchild, emacs-orgmode

Hi Daniel,

Daniel Kraus <daniel@kraus.my> writes:

> Does anyone remember what's the status of ob-clojure session
> support?

I'm randomly connected for the next days so I won't risk a reply here,
I hope others can help.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)
  2022-10-28  9:40       ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
  2022-10-28 10:20         ` ob-clojure session support Bastien Guerry
@ 2022-10-29  3:03         ` Ihor Radchenko
  2022-10-29  8:07           ` ob-clojure session support Bastien Guerry
  2022-10-30 11:33           ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
  1 sibling, 2 replies; 13+ messages in thread
From: Ihor Radchenko @ 2022-10-29  3:03 UTC (permalink / raw)
  To: Daniel Kraus; +Cc: Bastien, numbchild, emacs-orgmode

Daniel Kraus <daniel@kraus.my> writes:

> Looking in the history, Christopher added session support 5 years ago,
> then (3 years ago) I see Bastien also adding something with initiate-session but
> then removing all session support the following commit.
> I guess something was broken and got removed but stayed in the test?
>
> Does anyone remember what's the status of ob-clojure session support?

We have documented session support in
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
Therefore, Org users assume that sessions are supported.

If Bastien removed session support, and you do not see any justification,
it was most likely an oversight. We generally avoid feature regressions:
https://bzg.fr/en/the-software-maintainers-pledge/

So, if sessions are currently not supported, it should be considered a
bug and fixed. Let me know if you need any help with the fix.

-- 
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>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure session support
  2022-10-29  3:03         ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Ihor Radchenko
@ 2022-10-29  8:07           ` Bastien Guerry
  2022-10-30 11:33           ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
  1 sibling, 0 replies; 13+ messages in thread
From: Bastien Guerry @ 2022-10-29  8:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Daniel Kraus, numbchild, emacs-orgmode

Hi Ihor and Daniel,

Ihor Radchenko <yantar92@posteo.net> writes:

> If Bastien removed session support, and you do not see any justification,
> it was most likely an oversight. 

From memory, I removed session support in ob-clojure.el because it was
too buggy.

> We generally avoid feature regressions:
> https://bzg.fr/en/the-software-maintainers-pledge/
>
> So, if sessions are currently not supported, it should be considered a
> bug and fixed. 

Indeed, having session support would be better.  
Thanks for reimplementing it!

-- 
 Bastien


^ permalink raw reply	[flat|nested] 13+ messages in thread

* indent-tabs-mode in org (was: ob-clojure eval error when has comment at end of code line)
  2022-10-28  4:05     ` Ihor Radchenko
  2022-10-28  9:40       ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
@ 2022-10-29 20:13       ` Daniel Kraus
  2022-10-31  9:49         ` indent-tabs-mode in org Bastien Guerry
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Kraus @ 2022-10-29 20:13 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, numbchild, emacs-orgmode


Ihor Radchenko <yantar92@posteo.net> writes:
> Daniel Kraus <daniel@kraus.my> writes:
>
>> - What should I use for indention? Looking in ob-clojure and org.el
>>   it seems that using tabs with tab-width 8 is standard but there's
>>   quite a few lines where it's spaces only.
> That is a good question. I guess, just Emacs default.
> Our code is not consistent here...
> Maybe Bastien can clarify better.

jFYI, because I was just wondering why the org
.dir-locals.el sets indent-tabs-mode to nil.
Luckily Kyle wrote a good commit message:

--cut--
.dir-locals.el: Set indent-tabs-mode to nil in Elisp sources

Despite .dir-locals.el having a catchall value of t for
indent-tabs-mode, Org's Elisp files are a mix of tabs and spaces.
Emacs has used a value of nil for indent-tabs-mode since 93d4412046
(Set indent-tabs-mode to nil in (most) Elisp sources, 2015-04-15).  Do
the same.

Ref: https://orgmode.org/list/87eejsg9vw.fsf@gnu.org
--cut--

So that clarifies it for me and I do NOT indent with tabs in the future :)

Cheers,
  Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)
  2022-10-29  3:03         ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Ihor Radchenko
  2022-10-29  8:07           ` ob-clojure session support Bastien Guerry
@ 2022-10-30 11:33           ` Daniel Kraus
  2022-10-30 12:45             ` Ihor Radchenko
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Kraus @ 2022-10-30 11:33 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, numbchild, emacs-orgmode


Ihor Radchenko <yantar92@posteo.net> writes:
>
> If Bastien removed session support, and you do not see any justification,
> it was most likely an oversight. We generally avoid feature regressions:
> https://bzg.fr/en/the-software-maintainers-pledge/
>
> So, if sessions are currently not supported, it should be considered a
> bug and fixed. Let me know if you need any help with the fix.

I agree that session support would be nice.
The cider backend (and maybe slime and inf-clojure, which I haven't installed/tried)
opens a connection and then all source blocks are evaled in this one session,
but you can't specify multiple.
For babashka, nbb, it's simply running the cli with the code from the source
block.

> Let me know if you need any help with the fix.

I feel adding session support for babashka and nbb (and maybe a future clojure-cli backend)
makes most sense.
Relying on `inf-clojure` would make this task simpler but this is also the
package the least amount of people will have installed, as cider is much more popular.

Is there a good (and simple) example of another babel package that implements
session support but doesn't depend on an external inf-xxx package?
Then I could use code from there.

Thanks,
  Daniel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: ob-clojure session support (was: ob-clojure eval error when has comment at end of code line)
  2022-10-30 11:33           ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
@ 2022-10-30 12:45             ` Ihor Radchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Ihor Radchenko @ 2022-10-30 12:45 UTC (permalink / raw)
  To: Daniel Kraus; +Cc: Bastien, numbchild, emacs-orgmode

Daniel Kraus <daniel@kraus.my> writes:

>> Let me know if you need any help with the fix.
>
> I feel adding session support for babashka and nbb (and maybe a future clojure-cli backend)
> makes most sense.
> Relying on `inf-clojure` would make this task simpler but this is also the
> package the least amount of people will have installed, as cider is much more popular.

Ideally, we want to support all the backends, but just cider (popular) +
easy ones will also do.

> Is there a good (and simple) example of another babel package that implements
> session support but doesn't depend on an external inf-xxx package?
> Then I could use code from there.

I'd say that ob-gnuplot is the simplest way. Given that we have an
equivalent of `gnuplot-send-buffer-to-gnuplot' command.

For more direct comint sessions, we have ob-comint.el library
implementing generic interactive sessions.
You can check out the usage of, say, `org-babel-comint-with-output', by
different babel backends.

-- 
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>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: indent-tabs-mode in org
  2022-10-29 20:13       ` indent-tabs-mode in org " Daniel Kraus
@ 2022-10-31  9:49         ` Bastien Guerry
  0 siblings, 0 replies; 13+ messages in thread
From: Bastien Guerry @ 2022-10-31  9:49 UTC (permalink / raw)
  To: Daniel Kraus; +Cc: Ihor Radchenko, numbchild, emacs-orgmode

Hi Daniel and Ihor,

Daniel Kraus <daniel@kraus.my> writes:

> So that clarifies it for me and I do NOT indent with tabs in the
> future :)

We can progressively replace tab chars with spaces, thus re-indenting
correctly all files in the repository.

The Emacs convention is to *not* commit space-only changes as they may
create merge conflicts.

For files that do not have pending patches, we can do the replacement
with the next code-related change.

2 cts,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-10-31  9:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11  4:08 ob-clojure eval error when has comment at end of code line Christopher M. Miles
2022-10-26  7:30 ` Ihor Radchenko
2022-10-27 12:25   ` Daniel Kraus
2022-10-27 14:17     ` Max Nikulin
2022-10-28  4:05     ` Ihor Radchenko
2022-10-28  9:40       ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
2022-10-28 10:20         ` ob-clojure session support Bastien Guerry
2022-10-29  3:03         ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Ihor Radchenko
2022-10-29  8:07           ` ob-clojure session support Bastien Guerry
2022-10-30 11:33           ` ob-clojure session support (was: ob-clojure eval error when has comment at end of code line) Daniel Kraus
2022-10-30 12:45             ` Ihor Radchenko
2022-10-29 20:13       ` indent-tabs-mode in org " Daniel Kraus
2022-10-31  9:49         ` indent-tabs-mode in org Bastien Guerry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).