all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Kraus <daniel@kraus.my>
To: Bastien <bzg@gnu.org>
Cc: Ihor Radchenko <yantar92@posteo.net>,
	numbchild@gmail.com, emacs-orgmode@gnu.org
Subject: Auto detect ob-clojure backend (was: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list)
Date: Sun, 30 Oct 2022 12:21:09 +0100	[thread overview]
Message-ID: <87bkptmu5v.fsf@kraus.my> (raw)
In-Reply-To: <87k04j6oic.fsf@gnu.org>

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


Bastien <bzg@gnu.org> writes:

> Daniel Kraus <daniel@kraus.my> writes:
>
>> I think I'll go with the big `cond` above to auto-detect what's
>> installed. That's probably the best out-of-the-box experience.
> Indeed, thank you!

I would push the attached patch.
I'm not sure about the `:package-version` keyword in defcustom.
I want to say that the default value changed.
Should I do it this way? Is `(Org . "9.6")` correct as it's unreleased?

Thanks,
  Daniel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-clojure.el-Auto-detect-backend.patch --]
[-- Type: text/x-patch, Size: 1351 bytes --]

From bd68ece99ce411439db87cd19e44ffbc49677ae3 Mon Sep 17 00:00:00 2001
From: Daniel Kraus <daniel@kraus.my>
Date: Sat, 29 Oct 2022 23:20:06 +0200
Subject: [PATCH] ob-clojure.el: Auto detect backend

* lisp/ob-clojure.el (org-babel-clojure-backend): Set the backend
to an available cli program or elisp package.
---
 lisp/ob-clojure.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 5654d5208..25f1c78a6 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -76,9 +76,16 @@
 (defvar org-babel-default-header-args:clojurescript '())
 (defvar org-babel-header-args:clojurescript '((package . :any)))
 
-(defcustom org-babel-clojure-backend nil
+(defcustom org-babel-clojure-backend (cond
+                                      ((executable-find "bb") 'babashka)
+                                      ((executable-find "nbb") 'nbb)
+                                      ((featurep 'cider) 'cider)
+                                      ((featurep 'inf-clojure) 'inf-clojure)
+                                      ((featurep 'slime) 'slime)
+				      (t nil))
   "Backend used to evaluate Clojure code blocks."
   :group 'org-babel
+  :package-version '(Org . "9.6")
   :type '(choice
 	  (const :tag "inf-clojure" inf-clojure)
 	  (const :tag "cider" cider)
-- 
2.38.1


  reply	other threads:[~2022-10-30 11:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <62520bbc.1c69fb81.d855b.549fSMTPIN_ADDED_BROKEN@mx.google.com>
2022-10-26  7:09 ` [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list Ihor Radchenko
2022-10-27 14:09   ` Daniel Kraus
2022-10-28  3:56     ` Ihor Radchenko
2022-10-28  8:51     ` Bastien Guerry
2022-10-28  9:09       ` Daniel Kraus
2022-10-28 10:22         ` Bastien
2022-10-28 21:09           ` Daniel Kraus
2022-10-29  8:08             ` Bastien
2022-10-30 11:21               ` Daniel Kraus [this message]
2022-10-30 12:02                 ` Auto detect ob-clojure backend (was: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list) Ihor Radchenko
2022-10-30 12:48                   ` Daniel Kraus
2022-10-30 13:25                     ` Ihor Radchenko
2022-10-30 14:12                       ` Auto detect ob-clojure backend Bastien Guerry
2022-10-30 20:04                     ` Auto detect ob-clojure backend (was: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list) Tim Cross
2022-10-30 20:26                       ` Daniel Kraus
2022-10-31  1:31                     ` Christopher M. Miles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkptmu5v.fsf@kraus.my \
    --to=daniel@kraus.my \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.