[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/inf-clojure b02ce23 118/313: Add arglists support in Lumo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/inf-clojure b02ce23 118/313: Add arglists support in Lumo |
Date: |
Wed, 11 Aug 2021 09:59:58 -0400 (EDT) |
branch: elpa/inf-clojure
commit b02ce23dd183743623f40c2ecc6f38ddb6ad303b
Author: Andrea Richiardi <a.richiardi.work@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Add arglists support in Lumo
This patch adds `inf-clojure-arglists-form-lumo` and modifies the body
of `inf-clojure-arglist` in order to comply with the different output
lumo spits out.
---
inf-clojure.el | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/inf-clojure.el b/inf-clojure.el
index 393df71..650df8d 100644
--- a/inf-clojure.el
+++ b/inf-clojure.el
@@ -596,7 +596,7 @@ If you are using REPL types, it will pickup the most
approapriate
(define-obsolete-variable-alias 'inf-clojure-var-source-command
'inf-clojure-var-source-form "2.0.0")
-(defcustom inf-clojure-arglist-form
+(defcustom inf-clojure-arglists-form
"(try
(:arglists
(clojure.core/meta
@@ -607,7 +607,21 @@ If you are using REPL types, it will pickup the most
approapriate
:type 'string
:package-version '(inf-clojure . "2.0.0"))
-(define-obsolete-variable-alias 'inf-clojure-arglist-command
'inf-clojure-arglist-form "2.0.0")
+(define-obsolete-variable-alias 'inf-clojure-arglist-command
'inf-clojure-arglists-form "2.0.0")
+
+(defcustom inf-clojure-arglists-form-lumo
+ "(lumo.repl/get-arglists \"%s\")"
+ "Lumo form to query inferior Clojure for a function's arglist."
+ :type 'string
+ :package-version '(inf-clojure . "2.0.0"))
+
+(defun inf-clojure-arglists-form ()
+ "Return the form to query inferior Clojure for arglists of a var.
+If you are using REPL types, it will pickup the most approapriate
+`inf-clojure-arglist-form` variant."
+ (pcase (inf-clojure--set-repl-type (inf-clojure-proc))
+ (`lumo inf-clojure-arglists-form-lumo)
+ (_ inf-clojure-arglists-form)))
(defcustom inf-clojure-completion-form
"(complete.core/completions \"%s\")\n"
@@ -725,6 +739,16 @@ prefix argument PROMPT-FOR-SYMBOL, it prompts for a symbol
name."
(inf-clojure-symbol-at-point))))
(comint-proc-query (inf-clojure-proc) (format inf-clojure-var-source-form
var))))
+(defun inf-clojure-match-arglists (input-form string)
+ "Return the arglists match from INPUT-FORM and STRING.
+The output depends on the correct REPL type. We assume the
+`inf-clojure-repl-type` var is already set, therefore this is
+safe to call only from inside `inf-clojure-arglist`."
+ (pcase inf-clojure-repl-type
+ (`lumo (let ((input-end (and (string-match input-form string) (match-end
0))))
+ (and (string-match "(.+)" string input-end) (match-string 0
string))))
+ (_ (and (string-match "(.+)" string) (match-string 0 string)))))
+
(defun inf-clojure-arglist (fn)
"Send a query to the inferior Clojure for the arglist for function FN.
See variable `inf-clojure-arglist-form'."
@@ -734,11 +758,11 @@ See variable `inf-clojure-arglist-form'."
eldoc)
(set-process-filter proc (lambda (_proc string) (setq kept (concat kept
string))))
(unwind-protect
- (let ((eldoc-snippet (format inf-clojure-arglist-form fn)))
- (process-send-string proc eldoc-snippet)
+ (let ((eldoc-snippet (format (inf-clojure-arglists-form) fn)))
+ (inf-clojure--send-string proc eldoc-snippet)
(while (and (not (string-match inf-clojure-prompt kept))
(accept-process-output proc 2)))
- (setq eldoc (and (string-match "(.+)" kept) (match-string 0 kept))))
+ (setq eldoc (inf-clojure-match-arglists eldoc-snippet kept)))
(set-process-filter proc comint-filt))
eldoc))
- [nongnu] elpa/inf-clojure 977e176 258/313: Mark this package as not part of Emacs, (continued)
- [nongnu] elpa/inf-clojure 977e176 258/313: Mark this package as not part of Emacs, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 4af94e6 271/313: Fixed two checkdoc warnings, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 62abe4e 278/313: Add Emacs 27 to the CI matrix, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure fd2d774 283/313: Bump the development version, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure dd7dd78 304/313: Tweak a couple of docstrings, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 1e99b82 306/313: The redundant bit of code was actually required (#191), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 9caed3e 092/313: Update the copyright years, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 3e22747 096/313: Use setq-local, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure d04c36c 107/313: [Fix #31] Add basic project type support, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 862699e 102/313: [Fix #41] Add a command to quit REPL buffers, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b02ce23 118/313: Add arglists support in Lumo,
ELPA Syncer <=
- [nongnu] elpa/inf-clojure ce0510b 124/313: Split inf-clojure-load-form by repl type, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 887da91 133/313: Use inf-clojure--sanitize-command everywhere, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure db9e985 130/313: Rename to arglists (plural) everywhere, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure b50102f 128/313: [Fix #58] Add a function to connect to remote socket repl (#68), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 6179a74 142/313: Extend the REPL type section of the README, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 4e96e93 147/313: Fix a bug causing read to output for expression, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 9ba23b0 149/313: Wrap a long line, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 956b22e 148/313: Release 2.0.1, ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 74e8423 150/313: Fix get-completions for lumo (#81), ELPA Syncer, 2021/08/11
- [nongnu] elpa/inf-clojure 9fa8f37 153/313: Disable pretty print when fetching lumo arglists, ELPA Syncer, 2021/08/11