view src/rlm/rlm_commands.clj @ 6:b8bbb0dbda7b

merging
author Robert McIntyre <rlm@mit.edu>
date Thu, 01 Mar 2012 05:55:59 -0700
parents 12d1367cf1aa 8565803376a4
children b4395ca99822
line wrap: on
line source
1 (ns rlm.rlm-commands
2 (:use rlm.ns-rlm)
3 (:use clojure.java.javadoc))
5 ;; (defn current-directory [] (ds/file-str "/home/r/mobius"))
7 ;; (defn file-re [regex & {:keys [dir recurse] :or
8 ;; {dir (current-directory) recurse false}}]
9 ;; (let [dir (ds/file-str dir)]
10 ;; (filter (fn [file] (re-matches regex (.getName file)))
11 ;; (if recurse
12 ;; (file-seq dir)
13 ;; (seq (.listFiles dir))))))
15 (defmacro undef
16 "removes symbol from the current namespace"
17 [& symbols]
18 `(dorun (map (partial ns-unmap *ns*) (quote ~symbols))))
20 (defn ns-reset-fn
21 "unmaps all interned symbols from the current namespace (except in-ns and ns)"
22 ([ns-name]
23 (map (fn [s] (ns-unmap ns-name s))
24 (keys (ns-interns ns-name)))))
26 (defmacro ns-reset
27 "unmaps all symbols from the current namespace (except in-ns and ns)"
28 ([ns-name] `(ns-clear-fn (quote ~ns-name)))
29 ([] `(ns-clear-fn (quote ~(symbol (str *ns*))))))
31 (defmacro ns-nuke-old
32 ([]
33 (let [current-ns# (symbol (str *ns*))]
34 `(do
35 (println "NUKING namespace" (quote ~current-ns#))
36 (clojure.lang.Namespace/remove (quote ~current-ns#))
37 (ns ~current-ns#)))))
39 (defmacro ns-nuke
40 "Removes all symbols and all referenced symbols. Use as a last
41 resort."
42 ([]
43 (let [current-ns# (symbol (str *ns*))]
44 `(ns-nuke ~current-ns#)))
45 ([ns]
46 `(do
47 (println "NUKING namespace" (quote ~ns))
48 (clojure.lang.Namespace/remove (quote ~ns))
49 (ns ~ns))))
51 (defmacro reload []
52 `(do
53 (rlm.rlm-commands/ns-nuke)
54 (clojure.core/use
55 :reload-all
56 (clojure.core/symbol (clojure.core/str clojure.core/*ns*)))))
58 (defmacro re "faster"
59 []
60 `(do
61 (rlm.rlm-commands/ns-nuke)
62 (clojure.core/use :reload
63 (clojure.core/symbol (clojure.core/str clojure.core/*ns*)))))
65 ;; (defn keymap-clojure []
66 ;; (rlm.shell-write/sw "xmodmap" "/home/r/.xmodmap.clojure"))
68 ;; (defn keymap-normal []
69 ;; (rlm.shell-write/sw "xmodmap" "/home/r/.xmodmap.normal"))
71 (defn javadoc [target]
72 (binding
73 [clojure.java.browse/*open-url-script*
74 "/home/r/proj/repl/get-webpage.pl"]
75 (clojure.java.javadoc/javadoc target)))
77 (defn help
78 "load a bunch of really useful help functions"
79 []
80 (use
81 '[rlm
82 [function-utils :only [race race-pred defmix]]
83 [rlm-commands :only
84 [undef ns-reset ns-nuke reload re]]
85 [ns-rlm :only [ls]]
86 ;;[play-all :only [play-all-music]]
87 [shell-inspect :only [command-line?]]
88 ;;[shell-write :only [sw]]
89 ;;[classpath-utils :only [classpath add-to-classpath]]
90 [dreams :only [megadef silence]]
91 [map-utils :only [map-keys filter-keys filter-vals]]
92 [visualize :only [visual]]
93 [identify :only [identify]]]
95 ;;'[abomination.no-parens :only [quit]]
97 ;; TODO find replacement for show
98 '[clojure
99 [repl :only [source]]])
100 (clojure.java.javadoc/add-local-javadoc
101 "/home/r/proj/jMonkeyEngine3/dist/javadoc")
102 (clojure.java.javadoc/add-local-javadoc
103 "/home/r/java/jdk6u30-docs/api")
104 (clojure.java.javadoc/add-local-javadoc
105 "/home/r/java/jdk6u30-docs/jdk/api")
106 (clojure.java.javadoc/add-local-javadoc
107 "/home/r/java/jdk6u30-docs/jre/api")
108 (clojure.java.javadoc/add-local-javadoc
109 "/home/r/proj/jmeCapture/docs")
110 (clojure.java.javadoc/add-local-javadoc
111 "/home/r/java/tritonus.sourceforge.net/apidoc")
112 nil)