Meikel  Brandmeyer avatar Meikel Brandmeyer committed cd14678

Make new doc code work with 1.2

Comments (0)

Files changed (2)


 ; Documentation:
 ; Mirror this from clojure 1.3 to allow backwards compatibility.
-(def ^:private special-doc-map
+(def ^{:private true} special-doc-map
   '{. {:url "java_interop#dot"
        :forms [(.instanceMember instance args*)
                (.instanceMember Classname args*)
   (assoc (meta nspace) :name (ns-name nspace)))
-(defn- print-doc [m]
+(defn- print-documentation [m]
   (println "-------------------------")
   (println (str (when-let [ns (:ns m)] (str (ns-name ns) "/")) (:name m)))
   The documentation is returned as a string."
   [namespace symbol]
   (if-let [special-name ('{& fn catch try finally try} symbol)]
-    (print-doc (special-doc namespace special-name))
+    (print-documentation (special-doc namespace special-name))
     (condp #(%1 %2) symbol
       special-doc-map           :>> (fn [_]
-                                      (print-doc (special-doc namespace symbol)))
-      find-ns                   :>> #(print-doc (namespace-doc %))
-      #(ns-resolve namespace %) :>> #(print-doc (meta %))
+                                      (print-documentation
+                                        (special-doc namespace symbol)))
+      find-ns                   :>> #(print-documentation (namespace-doc %))
+      #(ns-resolve namespace %) :>> #(print-documentation (meta %))
         (str "'" symbol "' could not be found. Please check the spelling.")))))
-(defn find-doc
+(defn find-documentation
   "Prints documentation for any var whose documentation or name
   contains a match for re-string-or-pattern"
               :when (and (:doc m)
                          (or (re-find (re-matcher re (:doc m)))
                              (re-find (re-matcher re (str (:name m))))))]
-               (print-doc m))))
+               (print-documentation m))))
 (defn javadoc-path-for-class
   "Translate the name of a Class to the path of its javadoc file."


 (defnail FindDoc
   "Usage: ng vimclojure.nails.FindDoc"
-  (backend/find-doc (.readLine *in*)))
+  (backend/find-documentation (.readLine *in*)))
 (defnail JavadocPath
   "Usage: ng vimclojure.nails.JavadocPath [options]"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.