summaryrefslogtreecommitdiff
path: root/cider-grimoire.el
diff options
context:
space:
mode:
authorarrdem <me@arrdem.com>2014-12-27 10:50:23 -0600
committerarrdem <me@arrdem.com>2014-12-27 10:50:23 -0600
commit4ad8383842249176d3b65b6cc1ab57064083d7fa (patch)
tree493d1f0a451a141d3ede65176cd88a75b3f494ee /cider-grimoire.el
parent6ec5ceac22219cb00b0287922877fe52302a76c5 (diff)
Use Grimoire 0.4.6 /search
- Remove (namespace version) case of cider-grimoire-url - Update cider-grimoire-url to use /search/v0 rather than full URL forging - Update test of cider-grimoire-url Fixes #916 as clojurescript and clojure namespaces will both now search up transparently without requiring plugin classpath introspection or anything else crazy.
Diffstat (limited to 'cider-grimoire.el')
-rw-r--r--cider-grimoire.el18
1 files changed, 7 insertions, 11 deletions
diff --git a/cider-grimoire.el b/cider-grimoire.el
index b3ed38a3..98e06c9e 100644
--- a/cider-grimoire.el
+++ b/cider-grimoire.el
@@ -37,21 +37,18 @@
(replace-regexp-in-string "\\/" "_SLASH_")
(replace-regexp-in-string "\\(\\`_\\)\\|\\(_\\'\\)" "")))
-(defun cider-grimoire-url (name ns clojure-version)
- "Generate a grimoire url from NAME, NS and CLOJURE-VERSION."
- (let ((clojure-version (concat (substring clojure-version 0 4) "0"))
- (base-url cider-grimoire-url))
- (if name
- (concat base-url clojure-version "/" ns "/" (cider-grimoire-replace-special name) "/")
- (concat base-url clojure-version "/" ns "/"))))
+(defun cider-grimoire-url (name ns)
+ "Generate a grimoire search v0 url from NAME, NS."
+ (let ((base-url cider-grimoire-url))
+ (when (and name ns)
+ (concat base-url "search/v0/" ns "/" (cider-grimoire-replace-special name) "/"))))
(defun cider-grimoire-web-lookup (symbol)
"Look up the grimoire documentation for SYMBOL."
(-if-let (var-info (cider-var-info symbol))
(let ((name (nrepl-dict-get var-info "name"))
(ns (nrepl-dict-get var-info "ns")))
- ;; TODO: add a whitelist of supported namespaces
- (browse-url (cider-grimoire-url name ns (cider--clojure-version))))
+ (browse-url (cider-grimoire-url name ns)))
(message "Symbol %s not resolved" symbol)))
;;;###autoload
@@ -76,8 +73,7 @@
(ns (nrepl-dict-get var-info "ns"))
(url-request-method "GET")
(url-request-extra-headers `(("Content-Type" . "text/plain"))))
- ;; TODO: add a whitelist of supported namespaces
- (url-retrieve (cider-grimoire-url name ns (cider--clojure-version))
+ (url-retrieve (cider-grimoire-url name ns)
(lambda (_status)
;; we need to strip the http header
(goto-char (point-min))