Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added some example files.

  • Loading branch information...
commit 7254b0b242d238ce877657e579d164a8a6c33ebf 1 parent 1f428f8
@technomancy authored
Showing with 69 additions and 2 deletions.
  1. +35 −2 init.el
  2. +34 −0 rooms.clj
View
37 init.el
@@ -1,2 +1,35 @@
-(load "/home/phil/src/elisp/starter-kit/elpa-to-submit/paredit")
-(load "/home/phil/src/elisp/starter-kit/elpa-to-submit/clojure-mode")
+;; Startup script for paredit screencast demo
+
+
+
+(load "/home/phil/src/elisp/paredit/paredit-beta")
+(load "/home/phil/src/elisp/starter-kit/elpa-to-submit/clojure-mode")
+
+(fringe-mode 0)
+(set-default-font "-unknown-Inconsolata-normal-normal-normal-*-19-*-*-*-m-0-*-*")
+(set-frame-size (caadr (current-frame-configuration)) 99 30)
+
+(ido-mode t)
+(show-paren-mode t)
+(tooltip-mode -1)
+(tool-bar-mode -1)
+(blink-cursor-mode -1)
+
+(setq start-dir (file-name-directory
+ (or (buffer-file-name) load-file-name)))
+
+(global-set-key (kbd "C-M-h") 'backward-kill-word)
+
+(defface paren-face
+ '((((class color) (background light))
+ (:foreground "grey15"))) "for parens")
+
+(defun intro ()
+ (interactive)
+ (find-file (concat start-dir "intro"))
+ (set-default-font "-unknown-Inconsolata-normal-normal-normal-*-60-*-*-*-m-0-*-*")
+ (set-frame-size (caadr (current-frame-configuration)) 33 12)
+ (font-lock-add-keywords nil '(("(\\|)" . 'paren-face)))
+ (dotimes (n 70)
+ (set-face-foreground 'paren-face (concat "grey" (number-to-string (- 80 n))))
+ (sit-for 0.01)))
View
34 rooms.clj
@@ -0,0 +1,34 @@
+;; From Mire, a multiplayer text adventure written in Clojure:
+;; http://github.com/technomancy/mire
+
+(ns mire.rooms)
+
+(declare rooms)
+
+(defn load-room [rooms file]
+ (let [room (read-string (slurp (.getAbsolutePath file)))]
+ (conj rooms
+ {(keyword (.getName file))
+ {:name (keyword (.getName file))
+ :desc (:desc room)
+ :exits (ref (:exits room))
+ :items (ref (or (:items room) #{}))
+ :inhabitants (ref #{})}})))
+
+(defn load-rooms [dir]
+ "Given a dir, return a map with an entry corresponding to each file
+in it. Files should be maps containing room data."
+ (reduce load-room {} (.listFiles (java.io.File. dir))))
+
+(defn set-rooms
+ "Set mire.rooms/rooms to a map of rooms corresponding to each file
+ in dir. This function should be used only once at mire startup, so
+ having a def inside the function body should be OK. Defaults to
+ looking in data/rooms/."
+ ([dir]
+ (def rooms (load-rooms dir)))
+ ([] (set-rooms "data/rooms/")))
+
+(defn room-contains?
+ [room thing]
+ (@(:items room) (keyword thing)))
Please sign in to comment.
Something went wrong with that request. Please try again.