emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-clojure f3d6a68 223/313: Add support for joker (#160)


From: ELPA Syncer
Subject: [nongnu] elpa/inf-clojure f3d6a68 223/313: Add support for joker (#160)
Date: Wed, 11 Aug 2021 10:00:21 -0400 (EDT)

branch: elpa/inf-clojure
commit f3d6a6878c9b3bbf457c1756443afaa385921b14
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Add support for joker (#160)
    
    This patch introduces the defcustoms necessary for supporting joker.
---
 CHANGELOG.md   |  1 +
 README.md      | 20 ++++++------
 inf-clojure.el | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6701933..c1d3360 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 ## master (unreleased)
 
+* [#160](https://github.com/clojure-emacs/inf-clojure/pull/160): Support 
[Joker](https://joker-lang.org/).
 * [#135](https://github.com/clojure-emacs/inf-clojure/pull/135): Improve 
command sanitation code.
 
 ## 2.1.0 (2018-01-02)
diff --git a/README.md b/README.md
index 692f3a7..3420f76 100644
--- a/README.md
+++ b/README.md
@@ -26,8 +26,9 @@ Clojure(Script) development:
 * Macroexpansion
 * Require `:reload`/`:reload-all`
 * Support connecting to socket REPLs
-* Support for Lumo
-* Support for Planck
+* Support for [Lumo](https://github.com/anmonteiro/lumo)
+* Support for [Planck](http://planck-repl.org/)
+* Support for [Joker](https://joker-lang.org/)
 
 For a more powerful/full-featured solution see 
[CIDER](https://github.com/clojure-emacs/cider).
 
@@ -267,9 +268,9 @@ You can see all the configuration options available using 
the command
 An `inf-clojure` REPL can be of different types: Clojure, ClojureScript, Lumo
 and Planck are all potentially valid options.
 
- At the moment, the default Clojure REPL, the Lumo REPL and the Planck REPL are
-supported (standard ClojureScript is lacking mostly because some features
-require to access the compiler state,
+At the moment, the default Clojure REPL, the Lumo REPL, the Planck REPL and the
+Joker REPL are supported (standard ClojureScript is lacking mostly because some
+features require to access the compiler state,
 [cljs-tooling](https://github.com/clojure-emacs/cljs-tooling) is a good
 candidate for enabling support).
 
@@ -311,10 +312,11 @@ You can leave it enabled, it just won't show anything in 
the echo area.
 #### Code Completion
 
 Code completion is particularly open to customization. Not only you can `setq`
-the customary `inf-clojure-completion-form`, `inf-clojure-completion-form-lumo`
-and `inf-clojure-completion-form-planck` - the form to send to the REPL - but
-you can also use `inf-clojure-completions-fn` for specifying a function that
-given the REPL response should return elisp data compatible with
+the customary `inf-clojure-completion-form`,
+`inf-clojure-completion-form-lumo`, `inf-clojure-completion-form-planck` and
+`inf-clojure-completion-form-joker` - the form to send to the REPL - but you
+can also use `inf-clojure-completions-fn` for specifying a function that given
+the REPL response should return elisp data compatible with
 
[`completion-at-point-functions`](https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html).
 For more info run `M-x describe-variable RET inf-clojure-completions-fn`.
 Another option is to have a look at
diff --git a/inf-clojure.el b/inf-clojure.el
index e1cfa31..84eac7d 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -48,6 +48,7 @@
 ;; * Support connecting to socket REPLs
 ;; * Support for Lumo
 ;; * Support for Planck
+;; * Support for Joker
 ;;
 ;; For a more powerful/full-featured solution see 
https://github.com/clojure-emacs/cider.
 ;;
@@ -276,6 +277,16 @@ often connecting to a remote REPL process."
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+;;;; Joker
+;;;; ====
+
+(defcustom inf-clojure--joker-repl-form
+  "(find-ns 'joker.repl)"
+  "Form to invoke in order to verify that we launched a Planck REPL."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defvar-local inf-clojure-repl-type nil
   "Symbol to define your REPL type.
 Its root binding is nil and it can be further customized using
@@ -292,6 +303,7 @@ See 
http://blog.jorgenschaefer.de/2014/05/race-conditions-in-emacs-process-filte
       (cond
        ((inf-clojure--some-response-p proc inf-clojure--lumo-repl-form) 'lumo)
        ((inf-clojure--some-response-p proc inf-clojure--planck-repl-form) 
'planck)
+       ((inf-clojure--some-response-p proc inf-clojure--joker-repl-form) 
'joker)
        (t 'clojure)))))
 
 (defun inf-clojure--set-repl-type (proc)
@@ -374,6 +386,15 @@ Clojure to load that file."
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-load-form-joker "(load-file \"%s\")"
+  "Joker format-string for building a Clojure expression to load a file.
+This format string should use `%s' to substitute a file name and
+should result in a Clojure form that will be sent to the inferior
+Clojure to load that file."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-load-form (proc)
   "Return the form to query the Inf-Clojure PROC for var's documentation.
 If you are using REPL types, it will pickup the most appropriate
@@ -381,6 +402,7 @@ If you are using REPL types, it will pickup the most 
appropriate
   (pcase (inf-clojure--set-repl-type proc)
     (`lumo inf-clojure-load-form-lumo)
     (`planck inf-clojure-load-form-planck)
+    (`joker inf-clojure-load-form-joker)
     (_ inf-clojure-load-form)))
 
 (defcustom inf-clojure-reload-form "(require '%s :reload)"
@@ -813,6 +835,13 @@ The prefix argument ARG can change the behavior of the 
command:
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-var-doc-form-joker
+  "(joker.repl/doc %s)"
+  "Joker form to query inferior Clojure for a var's documentation."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-var-doc-form (proc)
   "Return the form to query the Inf-Clojure PROC for a var's documentation.
 If you are using REPL types, it will pickup the most appropriate
@@ -821,6 +850,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-var-doc-form-lumo)
      (`planck inf-clojure-var-doc-form-planck)
+     (`joker inf-clojure-var-doc-form-joker)
      (_ inf-clojure-var-doc-form))))
 
 (defcustom inf-clojure-var-source-form
@@ -844,6 +874,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-var-source-form-joker
+  ""
+  "Joker form to query inferior Clojure for a var's source."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-var-source-form (proc)
   "Return the form to query the Inf-Clojure PROC for a var's source.
 If you are using REPL types, it will pickup the most appropriate
@@ -852,6 +889,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-var-source-form-lumo)
      (`planck inf-clojure-var-source-form-planck)
+     (`joker inf-clojure-var-source-form-joker)
      (_ inf-clojure-var-source-form))))
 
 (define-obsolete-variable-alias 'inf-clojure-var-source-command 
'inf-clojure-var-source-form "2.0.0")
@@ -887,6 +925,18 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.1.0"))
 
+(defcustom inf-clojure-arglists-form-joker
+  "(try
+     (:arglists
+      (joker.core/meta
+       (joker.core/resolve
+        (joker.core/read-string \"%s\"))))
+     (catch Error _ nil))"
+  "Joker form to query inferior Clojure for a function's arglists."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-arglists-form (proc)
   "Return the form to query the Inf-Clojure PROC for arglists of a var.
 If you are using REPL types, it will pickup the most appropriate
@@ -895,6 +945,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-arglists-form-lumo)
      (`planck inf-clojure-arglists-form-planck)
+     (`joker inf-clojure-arglists-form-joker)
      (_ inf-clojure-arglists-form))))
 
 (defcustom inf-clojure-completion-form
@@ -923,6 +974,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-completion-form-joker
+  ""
+  "Joker form to query inferior Clojure for completion candidates."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-completion-form (proc)
   "Return the form to query the Inf-Clojure PROC for completions.
 If you are using REPL types, it will pickup the most appropriate
@@ -931,6 +989,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-completion-form-lumo)
      (`planck inf-clojure-completion-form-planck)
+     (`joker inf-clojure-completion-form-joker)
      (_ inf-clojure-completion-form))))
 
 (defcustom inf-clojure-ns-vars-form
@@ -954,6 +1013,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-ns-vars-form-joker
+  ""
+  "Joker form to show the public vars in a namespace."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-ns-vars-form (proc)
   "Return the form to query the Inf-Clojure PROC for public vars in a 
namespace.
 If you are using REPL types, it will pickup the most appropriate
@@ -962,6 +1028,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-ns-vars-form-lumo)
      (`planck inf-clojure-ns-vars-form-planck)
+     (`joker inf-clojure-ns-vars-form-joker)
      (_ inf-clojure-ns-vars-form))))
 
 (define-obsolete-variable-alias 'inf-clojure-ns-vars-command 
'inf-clojure-ns-vars-form "2.0.0")
@@ -987,6 +1054,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-set-ns-form-joker
+  "(in-ns '%s)"
+  "Joker form to set the namespace of the inferior Clojure process."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-set-ns-form (proc)
   "Return the form to set the namespace of the Inf-Clojure PROC.
 If you are using REPL types, it will pickup the most appropriate
@@ -994,6 +1068,7 @@ If you are using REPL types, it will pickup the most 
appropriate
   (pcase (inf-clojure--set-repl-type proc)
     (`planck inf-clojure-set-ns-form-planck)
     (`lumo inf-clojure-set-ns-form-lumo)
+    (`joker inf-clojure-set-ns-form-joker)
     (_ inf-clojure-set-ns-form)))
 
 (define-obsolete-variable-alias 'inf-clojure-set-ns-command 
'inf-clojure-set-ns-form "2.0.0")
@@ -1021,6 +1096,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.0.0"))
 
+(defcustom inf-clojure-apropos-form-joker
+  ""
+  "Joker form to invoke apropos."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-apropos-form (proc)
   "Return the form to query the Inf-Clojure PROC for a var's apropos.
 If you are using REPL types, it will pickup the most appropriate
@@ -1029,6 +1111,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-apropos-form-lumo)
      (`planck inf-clojure-apropos-form-planck)
+     (`joker inf-clojure-apropos-form-joker)
      (_ inf-clojure-apropos-form))))
 
 (define-obsolete-variable-alias 'inf-clojure-apropos-command 
'inf-clojure-apropos-form "2.0.0")
@@ -1054,6 +1137,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.2.0"))
 
+(defcustom inf-clojure-macroexpand-form-joker
+  "(macroexpand '%s)"
+  "Joker form to invoke macroexpand."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-macroexpand-form (proc)
   "Return the form for macroexpansion in the Inf-Clojure PROC.
 If you are using REPL types, it will pickup the most appropriate
@@ -1062,6 +1152,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-macroexpand-form-lumo)
      (`planck inf-clojure-macroexpand-form-planck)
+     (`joker inf-clojure-macroexpand-form-joker)
      (_ inf-clojure-macroexpand-form))))
 
 (define-obsolete-variable-alias 'inf-clojure-macroexpand-command 
'inf-clojure-macroexpand-form "2.0.0")
@@ -1087,6 +1178,13 @@ If you are using REPL types, it will pickup the most 
appropriate
   :safe #'stringp
   :package-version '(inf-clojure . "2.2.0"))
 
+(defcustom inf-clojure-macroexpand-1-form-joker
+  "(macroexpand-1 '%s)"
+  "Joker form to invoke macroexpand-1."
+  :type 'string
+  :safe #'stringp
+  :package-version '(inf-clojure . "2.2.0"))
+
 (defun inf-clojure-macroexpand-1-form (proc)
   "Return the form for macroexpand-1 in the Inf-Clojure PROC.
 If you are using REPL types, it will pickup the most appropriate
@@ -1095,6 +1193,7 @@ If you are using REPL types, it will pickup the most 
appropriate
    (pcase (inf-clojure--set-repl-type proc)
      (`lumo inf-clojure-macroexpand-1-form-lumo)
      (`planck inf-clojure-macroexpand-1-form-planck)
+     (`joker inf-clojure-macroexpand-1-form-joker)
      (_ inf-clojure-macroexpand-1-form))))
 
 (define-obsolete-variable-alias 'inf-clojure-macroexpand-1-command 
'inf-clojure-macroexpand-1-form "2.0.0")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]