Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'make-completion-configurable' of https://github.com/hug…

…oduncan/nrepl.el into hugoduncan-make-completion-configurable
  • Loading branch information...
commit a7a11acac8fe972317f3f7a4f0b2b558d99bfa56 2 parents 674a5a2 + a80008e
@kingtim kingtim authored
Showing with 16 additions and 12 deletions.
  1. +16 −12 nrepl.el
View
28 nrepl.el
@@ -331,24 +331,28 @@ joined together.")
(defalias 'nrepl-jump-back 'pop-tag-mark)
+(defvar nrepl-completion-fn 'nrepl-completion-complete-core-fn)
+
+(defun nrepl-completion-complete-core-fn (str)
+ "Return a list of completions using complete.core/completions."
+ (nrepl-send-string "(clojure.core/require 'complete.core)" "user" 'identity)
+ (let ((strlst (plist-get
+ (nrepl-send-string-sync
+ (format "(complete.core/completions \"%s\" *ns*)" str)
+ nrepl-buffer-ns)
+ :value)))
+ (when strlst
+ (car (read-from-string strlst)))))
+
(defun nrepl-complete-at-point ()
;; TODO: need a unified way to trigger this loading at connect-time
;; TODO: better error handling if dependency is missing
+ (message "complete-at-point %s" nrepl-completion-fn)
(let ((sap (symbol-at-point)))
(when (and sap (not (in-string-p)))
(let ((bounds (bounds-of-thing-at-point 'symbol)))
- (list (car bounds) (cdr bounds)
- (completion-table-dynamic
- (lambda (str)
- (nrepl-send-string "(clojure.core/require 'complete.core)"
- "user" 'identity)
- (let ((strlst (plist-get
- (nrepl-send-string-sync
- (format "(complete.core/completions \"%s\" *ns*)" str)
- nrepl-buffer-ns)
- :value)))
- (when strlst
- (car (read-from-string strlst)))))))))))
+ (list (car bounds) (cdr bounds)
+ (completion-table-dynamic nrepl-completion-fn))))))
(defun nrepl-eldoc-format-thing (thing)
(propertize thing 'face 'font-lock-function-name-face))
Please sign in to comment.
Something went wrong with that request. Please try again.