view src/rlm/rlm_commands.clj @ 9:1065e7d615a4 tip

deactivate some cruft.
author Robert McIntyre <rlm@mit.edu>
date Mon, 08 Jul 2013 12:51:12 -0400
parents b4395ca99822
children
line wrap: on
line source
1 (ns rlm.rlm-commands
2 (:use rlm.ns-rlm)
3 (:require 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)
102 (dorun
103 (map
104 clojure.java.javadoc/add-local-javadoc
106 ["/home/r/proj/jMonkeyEngine3/dist/javadoc"
108 ;; java standard library
109 "/home/r/java/jdk-docs/javafx/api"
110 "/home/r/java/jdk-docs/jdk/api"
111 "/home/r/java/jdk-docs/jdk/jre/api"
112 "/home/r/java/jdk-docs/jdk/jdk/api"
114 ;; cortex stuff
115 "/home/r/proj/jmeCapture/docs"
116 "/home/r/java/tritonus.sourceforge.net/apidoc"
118 ;; genesis stuff
119 "/home/r/git/genesis/docs"
120 "/home/r/git/propagators/docs"]
121 )))