On Jul 2, 7:46 am, Takeshi Banse <tak...@laafc.net> wrote:
> Hi all,
> I Takeshi Banse live in Japan, have been teaching myself Clojure and in the
> process have a patch to theswank-clojure I'd like to make.
>
> With this patch, I can happily `M-x slime-apropos' within Emacs/SLIME.
>
> Hope this helps. Thanks.
>
This is fantastic. I look forward to seeing it in the main swank-
clojure.
Thanks for writing it, that's great. Also to Jeffrey Chu for his
substantial work on this project.
I note that Phil Hagelberg's swank-clojure tree[1] has a file that was
updated just 3 days ago (today is Jul. 6). The official jochu tree[2]
was last updated a month ago - early June. It looks like Phil might be
able to integrate this and then send a request to jochu to
synchronize, which would make it easier if jochu can't take care of it
right away?
You might consider contacting Phil. His email can be found at the
website below[3].
It's great to see these development tools keep growing - Clojure may
yet wind up having one of the nicest overall language environments to
work in. Thank you guys for working on it.
[1] - http://github.com/technomancy/swank-clojure/tree/master
[2] - http://github.com/jochu/swank-clojure/tree/master
[3] - http://github.com/technomancy
> swank/commands/basic.clj | 61
> ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 61 insertions(+), 0 deletions(-)
>
> diff --git a/swank/commands/basic.clj b/swank/commands/basic.clj
> index 47555a4..d668d2d 100644
> --- a/swank/commands/basic.clj
> +++ b/swank/commands/basic.clj
> @@ -161,6 +161,67 @@ (defslimefn documentation-symbol
> ([symbol-name default] (documentation-symbol symbol-name))
> ([symbol-name] (describe-symbol* symbol-name)))
>
> +;;;; Documentation
> +
> +(defn- briefly-describe-symbol-for-emacs [var]
> + (let [lines (fn [s] (seq (.split s (System/getProperty "line.separator"))))
> + [_ symbol-name arglists d1 d2 & __] (lines (describe-to-string var))
> + macro? (= d1 "Macro")]
> + (list :designator symbol-name
> + (cond
> + macro? :macro
> + (:arglists ^var) :function
> + :else :variable)
> + (apply str (concat arglists (if macro? d2 d1))))))
> +
> +(defn- make-apropos-matcher [pattern case-sensitive?]
> + (let [pattern (java.util.regex.Pattern/quote pattern)
> + pat (re-pattern (if case-sensitive?
> + pattern
> + (format "(?i:%s)" pattern)))]
> + (fn [var] (re-find pat (pr-str var)))))
> +
> +(defn- apropos-symbols [string external-only? case-sensitive? package]
> + (let [packages (or (when package [package]) (all-ns))
> + matcher (make-apropos-matcher string case-sensitive?)
> + lister (if external-only? ns-publics ns-interns)]
> + (filter matcher
> + (apply concat (map (comp (partial map second) lister)
> + packages)))))
> +
> +(defn- present-symbol-before
> + "Comparator such that x belongs before y in a printed summary of symbols.
> +Sorted alphabetically by namespace name and then symbol name, except
> +that symbols accessible in the current namespace go first."
> + [x y]
> + (let [accessible?
> + (fn [var] (= (ns-resolve (maybe-ns *current-package*) (:name ^var))
> + var))
> + ax (accessible? x) ay (accessible? y)]
> + (cond
> + (and ax ay) (compare (:name ^x) (:name ^y))
> + ax -1
> + ay 1
> + :else (let [nx (str (:ns ^x)) ny (str (:ns ^y))]
> + (if (= nx ny)
> + (compare (:name ^x) (:name ^y))
> + (compare nx ny))))))
> +
> +(defslimefn apropos-list-for-emacs
> + ([name]
> + (apropos-list-for-emacs name nil))
> + ([name external-only?]
> + (apropos-list-for-emacs name external-only? nil))
> + ([name external-only? case-sensitive?]
> + (apropos-list-for-emacs name external-only? case-sensitive? nil))
> + ([name external-only? case-sensitive? package]
> + (let [package (when package
> + (or (find-ns (symbol package))
> + 'user))]
> + (map briefly-describe-symbol-for-emacs
> + (sort present-symbol-before
> + (apropos-symbols name external-only? case-sensitive?
> + package))))))
>
> ;;;; Operator messages
> (defslimefn operator-arglist [name package]
> --
> 1.6.3.3.386.gfe2a5
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---