Mercurial > rlm
view src/rlm/rlm_commands.clj @ 1:8565803376a4
upgrading source to work with clojure 1.4
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 28 Feb 2012 13:26:34 -0600 |
parents | 78a630e650d2 |
children | b8bbb0dbda7b |
line wrap: on
line source
1 (ns rlm.rlm-commands2 (:use rlm.ns-rlm)3 (:use clojure.java.javadoc))6 ;; (defn current-directory [] (ds/file-str "/home/r/mobius"))8 ;; (defn file-re [regex & {:keys [dir recurse] :or9 ;; {dir (current-directory) recurse false}}]10 ;; (let [dir (ds/file-str dir)]11 ;; (filter (fn [file] (re-matches regex (.getName file)))12 ;; (if recurse13 ;; (file-seq dir)14 ;; (seq (.listFiles dir))))))16 (defmacro undef17 "removes symbol from the current namespace"18 [& symbols]19 `(dorun (map (partial ns-unmap *ns*) (quote ~symbols))))21 (defn ns-reset-fn22 "unmaps all interned symbols from the current namespace (except in-ns and ns)"23 ([ns-name]24 (map (fn [s] (ns-unmap ns-name s))25 (keys (ns-interns ns-name)))))27 (defmacro ns-reset28 "unmaps all symbols from the current namespace (except in-ns and ns)"29 ([ns-name] `(ns-clear-fn (quote ~ns-name)))30 ([] `(ns-clear-fn (quote ~(symbol (str *ns*))))))32 (defmacro ns-nuke-old33 ([]34 (let [current-ns# (symbol (str *ns*))]35 `(do36 (println "NUKING namespace" (quote ~current-ns#))37 (clojure.lang.Namespace/remove (quote ~current-ns#))38 (ns ~current-ns#)))))40 (defmacro ns-nuke41 "Removes all symbols and all referenced symbols. Use as a last42 resort."43 ([]44 (let [current-ns# (symbol (str *ns*))]45 `(ns-nuke ~current-ns#)))46 ([ns]47 `(do48 (println "NUKING namespace" (quote ~ns))49 (clojure.lang.Namespace/remove (quote ~ns))50 (ns ~ns))))52 (defmacro reload []53 `(do54 (rlm.rlm-commands/ns-nuke)55 (clojure.core/use56 :reload-all57 (clojure.core/symbol (clojure.core/str clojure.core/*ns*)))))59 (defmacro re "faster"60 []61 `(do62 (rlm.rlm-commands/ns-nuke)63 (clojure.core/use :reload64 (clojure.core/symbol (clojure.core/str clojure.core/*ns*)))))66 ;; (defn keymap-clojure []67 ;; (rlm.shell-write/sw "xmodmap" "/home/r/.xmodmap.clojure"))69 ;; (defn keymap-normal []70 ;; (rlm.shell-write/sw "xmodmap" "/home/r/.xmodmap.normal"))72 ;; (defn rlm []73 ;; (clojure.core/require 'rlm.light-base)74 ;; (rlm.ns-rlm/ns-clone rlm.light-base))76 (defn help77 "load a bunch of really useful help functions"78 []79 (use80 '[rlm81 [function-utils :only [mix defmix]]82 [rlm-commands :only83 [undef ns-reset ns-nuke reload re]]84 [ns-rlm :only [ls]]85 ;;[play-all :only [play-all-music]]86 [shell-inspect :only [command-line?]]87 ;;[shell-write :only [sw]]88 ;;[classpath-utils :only [classpath add-to-classpath]]89 [dreams :only [megadef silence]]90 [map-utils :only [map-keys map-vals filter-keys filter-vals]]91 [visualize :only [visual]]92 [identify :only [identify]]]94 ;;'[abomination.no-parens :only [quit]]96 ;; TODO find replacement for show97 '[clojure98 [repl :only [source]]]99 '[clojure.java100 [javadoc :only [javadoc add-local-javadoc]]])101 (clojure.java.javadoc/add-local-javadoc "/home/r/cortex/jme3/dist/javadoc")102 (clojure.java.javadoc/add-local-javadoc "/home/r/roBin/jdk6-docs/docs/api")103 (clojure.java.javadoc/add-local-javadoc104 "/home/r/roBin/lpsolve-doc/lpsolve.sourceforge.net/5.5/Java/docs/api")105 (clojure.java.javadoc/add-local-javadoc106 "/home/r/roBin/lpsolve-doc/lpsolve.sourceforge.net/5.5/Java/docs/api")108 nil)