[from now] 2012/06/01 09:30:18

diff --git c/.gitignore i/.gitignore
index e43b0f9..159c534 100644
--- c/.gitignore
+++ i/.gitignore
@@ -1 +1,5 @@
 .DS_Store
+
+emacs.d/*
+!emacs.d/init.el
+!emacs.d/modules/
diff --git c/emacs.d/init.el i/emacs.d/init.el
index 0702e15..f518aa5 100644
--- c/emacs.d/init.el
+++ i/emacs.d/init.el
@@ -1,38 +1,116 @@
-;;; -*- Coding: utf-8-unix; Mode: Emacs-Lisp; -*-
-;;; init.el
-(setq user-full-name "Kaz Yoshihara"
-      user-mail-address "m at kroneko dot com")
+;;; .emacs.d/init.el --- Emacs Initialization File
+;; Author: kaz
+;; Version: 0.013
+
+;;; Commentary:
+;;
+;; Copyright (c) 2009-2012 kaz
+;;
+;; Permission is hereby granted, free of charge, to any person obtaining a copy
+;; of this software and associated documentation files (the "Software"), to deal
+;; in the Software without restriction, including without limitation the rights
+;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+;; copies of the Software, and to permit persons to whom the Software is
+;; furnished to do so, subject to the following conditions:
+;;
+;; The above copyright notice and this permission notice shall be included in
+;; all copies or substantial portions of the Software.
+;;
+;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+;; FITNESS FOR A PARTICULAR PURPOSE AND NONIN- FRINGEMENT. IN NO EVENT SHALL
+;; THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+;; DEALINGS IN THE SOFTWARE.
+;;
+
+;;; Code:
+(defun kk::basic-setup ()
+  (progn
+    (setq user-full-name "kaz")
+    (setq user-mail-address "m at kroneko dot com")
+    (setq global-font-lock-mode t)
+    (setq auto-compression-mode t)
+    (setq file-name-shadow-mode t)
+    (setq require-final-newline t)
+    (setq indicate-empty-lines t)
+    (setq dired-dwim-target t)
+    (setq font-lock-maximum-decoration t)
+    (setq generic-define-unix-modes t)
+    (setq transient-mark-mode t)
+
+    (setq backup-by-copying t)
+    (setq backup-by-copying-when-linked t)
+    (setq completion-ignored-extensions t)
+    (setq backup-by-copying-when-mismatch t)
+    (setq message-log-max 1300)
+    (setq debug-on-error t)
+    ;; (setq debug-on-error nil)
+
+    (setq frame-title-format '(buffer-file-name "%f" ("%b")))
+    (setq special-display-buffer-names
+          (nconc '("*Backtrace*"
+                   "*VC-log"
+                   "*compilation*"
+                   "*Compile-Log*")
+                 special-display-buffer-names))
+    (setq inhibit-splash-screen t))
+
+  (progn
+    (setq line-number-mode t)
+    (setq column-number-mode t)
+    (setq size-indication-mode t))
+
+  (progn
+    (setq locale-encoding-system 'utf-8)
+    (setq terminal-encoding-system 'utf-8)
+    (setq keyboard-encoding-system 'utf-8)
+    (setq selection-encoding-system 'utf-8)
+    (setq prefer-coding-system 'utf-8)
+
+    (setq read-quoted-char-radix 10))
+  (progn
+    (setq-default indent-tabs-mode nil)))
+
+(require 'kk-predicates nil t)

-(defun user-first-name ()
-  (car (split-string user-full-name)))
-
-;; (setq debug-on-error t)
-(setq debug-on-error nil)
 (when (< emacs-major-version 23)
   (setq user-emacs-directory "~/.emacs.d"))

 (setq emacsd user-emacs-directory
       emacsd-bin-dir (file-name-as-directory (concat emacsd "bin/"))
-
       emacsd-etc-dir (file-name-as-directory (concat emacsd "etc/"))
       emacsd-snippets-dir (file-name-as-directory (concat emacsd-etc-dir "snippets/"))
-
       emacsd-modules-dir (file-name-as-directory (concat emacsd "modules/"))
-      emacsd-vendor (file-name-as-directory) (concat emacsd "vendor/")
-
+      emacsd-vendor (file-name-as-directory (concat emacsd "vendor/"))
       emacsd-tmp-dir (file-name-as-directory (concat emacsd "tmp/"))
       emacsd-backups-dir (file-name-as-directory (concat emacsd-tmp-dir "backups/"))
       emacsd-autosaves-dir (file-name-as-directory (concat emacsd-tmp-dir "autosaves/"))
-
       emacsd-private-dir (file-name-as-directory (concat emacsd "private/"))
       custom-file (concat emacsd "custom.el"))
+
+(kk::basic-setup)
+
+(defun can-access? (dir)
+  (if (and dir
+           (file-accessible-directory-p dir)) dir
+    nil))
+
+(defun prep-dir (dir)
+  (or (can-access? dir)
+      (progn (make-directory dir t)
+             dir)))
+
+(defun make-dir-iff-nonexist (dir)
+  (unless (file-accessible-directory-p dir)
+    (make-directory dir t)))
 (progn
   (make-directory emacsd-etc-dir t)
   (make-directory emacsd-tmp-dir t)
   (make-directory emacsd-backups-dir t)
   (make-directory emacsd-autosaves-dir t))

-
 (setq emacsd user-emacs-directory
       emacsd-modules (expand-file-name "modules/" user-emacs-directory)
       emacsd-scripts (expand-file-name "scripts/" user-emacs-directory)
@@ -42,18 +120,18 @@
       emacsd-vendor (expand-file-name "vendor/" user-emacs-directory)
       emacsd-vendor (expand-file-name "vendor/" user-emacs-directory))

-
-(require 'package)
+(require 'package nil t)
 (add-to-list 'package-archives
              '("melpa" . "http://melpa.milkbox.net/packages/") t)
 (add-to-list 'package-archives
              '("marmalade" . "http://marmalade-repo.org/packages/") t)
-
 (package-initialize)
 (setq url-http-attempt-keepalives nil)
+
 (unless package-archive-contents
   (message "%s" "Refreshing package database.")
   (package-refresh-contents))
+
 (unless (require 'melpa nil t) (package-install 'melpa)
         (require 'melpa))

@@ -62,45 +140,47 @@
      (defvar ,name ,value ,docstring)
      (make-variable-buffer-local ',name)))

-(progn
-  (defun kk-turn-on-local-column-number-mode ()
-    (make-local-variable 'column-number-mode)
-    (column-number-mode t))
-  (defun kk-turn-on-whitespace () (whitespace-mode +1))
-  (defun kk-turn-off-whitespace () (whitespace-mode -1))
-  (defun kk-turn-on-linum-mode () (linum-mode +1))
-  (defun kk-turn-off-linum-mode () (linum-mode -1))
-  (defun kk-turn-on-ac () (auto-complete-mode +1))
-  (defun kk-turn-off-ac () (auto-complete-mode -1))
-  (defun kk-turn-on-abbrev () (abbrev-mode +1))
-  (defun kk-turn-off-abbrev () (abbrev-mode -1))
-  (defun kk-indent-buffer ()
-    (interactive)
-    (indent-region (point-min) (point-max)))
-  (defun kk-indent-region-or-buffer ()
-    (interactive)
-    (save-excursion
-      (if (region-active-p)
-          (progn (indent-region
-                  (region-beginning) (region-end))
-                 (message "Indented selected region."))
+(defun kk-turn-on-local-column-number-mode ()
+  (make-local-variable 'column-number-mode)
+  (column-number-mode t))
+(defun kk-turn-on-whitespace () (whitespace-mode +1))
+(defun kk-turn-off-whitespace () (whitespace-mode -1))
+(defun kk-turn-on-linum-mode () (linum-mode +1))
+(defun kk-turn-off-linum-mode () (linum-mode -1))
+(defun kk-turn-on-ac () (auto-complete-mode +1))
+(defun kk-turn-off-ac () (auto-complete-mode -1))
+(defun kk-turn-on-abbrev () (abbrev-mode +1))
+(defun kk-turn-off-abbrev () (abbrev-mode -1))
+(defun kk-indent-buffer () (interactive) (indent-region (point-min) (point-max)))
+(defun kk-indent-region-or-buffer ()
+  (interactive)
+  (save-excursion
+    (if (region-active-p)
+        (progn (indent-region
+                (region-beginning) (region-end))
+               (message "Indented selected region."))
         (progn (kk-indent-buffer)
                (message "Indented buffer.")))))
-  (defun kk-untabify-buffer ()
-    (interactive)
-    (untabify (point-min) (point-max)))
-  (defun kk-cleanup-buffer ()
-    (interactive)
-    (kk-indent-buffer)
-    (kk-untabify-buffer)
-    (whitespace-cleanup))
-
-  (defun kk-paredit-nonlisp ()
-    (interactive)
-    (set (make-local-variable 'paredit-space-for-delimiter-predicates)
-         '((lambda (endp delimiter) nil)))
-    (paredit-mode +1))
-  (defun kk-add-watchwords () (font-lock-add-keywords nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)" 1 font-lock-warning-face t))))) ;; TURN_ON/OFFs
+(defun kk-untabify-buffer ()
+  (interactive)
+  (untabify (point-min) (point-max)))
+(defun kk-cleanup-buffer ()
+  (interactive)
+  (kk-indent-buffer)
+  (kk-untabify-buffer)
+  (whitespace-cleanup))
+
+(defun kk-paredit-nonlisp ()
+  (interactive)
+  (set (make-local-variable 'paredit-space-for-delimiter-predicates)
+       '((lambda (endp delimiter) nil)))
+  (paredit-mode +1))
+
+(defun kk-add-watchwords ()
+  (font-lock-add-keywords
+   nil
+   '(("\\<\\(FIX\\(ME\\)?\\|TODO\\|HACK\\|REFACTOR\\|NOCOMMIT\\)"
+      1 font-lock-warning-face t))))

 (setq linum-format "%3d")
 (setq whitespace-style '(trailing lines space-before-tab indentation)
@@ -114,56 +194,44 @@
 (add-hook 'prog-mode-hook 'kk-add-watchwords)
 ;; (add-hook 'prog-mode-hook 'kk-local-comment-auto-fill)

-(unless (require 'evil nil t)
-  (viper-mode +1))
-(progn
-  (require 'evil)
-  (evil-mode +1)
-  (require 'surround)
-  (global-surround-mode +1)
-  (setq evil-default-state 'normal)
-  (setq evil-auto-indent t)
-  (setq evil-shift-width 4)
-  (setq evil-search-wrap t)
-
-  (setq evil-want-C-u-scroll t)
-  (setq evil-want-C-w-in-emacs-state t)
-  (setq evil-want-fine-undo t)
-
-  ;; evil cursors
-  (setq evil-default-cursor '("white" hbar))
-  (setq evil-normal-state-cursor '("gray50" hbar))
-  (setq evil-insert-state-cursor '("gray90" bar))
-  (setq evil-visual-state-cursor '("gray20" box))
-  (setq evil-motion-state-cursor '("black" hbar))
-  (setq evil-replace-state-cursor '("red" hollow))
-  (setq evil-operator-state-cursor '("black" box))
-
-  (define-key evil-normal-state-map (kbd "SPC") 'evil-toggle-fold)
-
-  (evil-declare-key 'normal emacs-lisp-mode-map
-		  (kbd "E") 'eval-buffer
-		  (kbd "=") 'eval-last-sexp)) ;; EVIL

-(progn
-  (setq darwin-p (eq system-type 'darwin)
-        is-darwin darwin-p
-        ns-p (featurep 'ns)
-        has-ns ns-p
-        carbon-p (eq window-system 'mac)
-        linux-p (eq system-type 'gnu/linux))) ;; system-type predicates
-(progn
-  (when darwin-p
-    (setq mac-function-modifier 'hyper
-          mac-option-modifier 'meta
-          mac-command-modifier 'meta
-          mac-right-option-modifier 'alt
-          mac-right-command-modifier 'super
-          menu-bar-mode +1
-          mac-allow-anti-aliasing +1
-          system-name (car (split-string system-name "\\.")))
-    (when has-ns
-      (global-set-key (kbd "M-RET") 'ns-toggle-fullscreen)))) ;; Darwin
+(add-to-list 'load-path emacsd-modules)
+(require 'kk-evil nil t)
+(require 'kk-orgmode nil t)
+
+(setq darwin-p (eq system-type 'darwin)
+      is-darwin darwin-p
+      ns-p (featurep 'ns)
+      has-ns ns-p
+      carbon-p (eq window-system 'mac)
+      linux-p (eq system-type 'gnu/linux))
+
+(defun setq-darwinp ()
+  (setq mac-function-modifier 'hyper
+        mac-option-modifier 'meta
+        mac-command-modifier 'meta
+        mac-right-option-modifier 'alt
+        mac-right-command-modifier 'super)
+
+  (setq menu-bar-mode t
+        mac-allow-anti-aliasing t)
+
+  (setq system-name (car (split-string system-name "\\.")))
+
+  (when has-ns
+    (global-set-key (kbd "M-RET") 'ns-toggle-fullscreen)))
+
+(when darwin-p
+  (setq mac-function-modifier 'hyper
+        mac-option-modifier 'meta
+        mac-command-modifier 'meta
+        mac-right-option-modifier 'alt
+        mac-right-command-modifier 'super
+        menu-bar-mode +1
+        mac-allow-anti-aliasing +1
+        system-name (car (split-string system-name "\\.")))
+  (when has-ns
+    (global-set-key (kbd "M-RET") 'ns-toggle-fullscreen)))

 (defmacro set-path (list-var list)
@@ -188,11 +256,10 @@
                 "/usr/sbin/"
                 "/Developer/Tools"))

-(progn
-  (defun add-auto-mode (mode &rest patterns)
-    "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
-    (dolist (pattern patterns)
-      (add-to-list 'auto-mode-alist (cons pattern mode))))) ;; Helper Functions
+(defun add-auto-mode (mode &rest patterns)
+  "Add entries to `auto-mode-alist' to use `MODE' for all given file `PATTERNS'."
+  (dolist (pattern patterns)
+    (add-to-list 'auto-mode-alist (cons pattern mode))))

 (defun string-all-matches (regex str &optional group)
   "Find all matches for `REGEX' within `STR'.
@@ -204,15 +271,19 @@ Returning the full match string or group `GROUP'."
       (push (match-string group str) result)
       (setq pos (match-end group)))
     result))
+
 (defun string-rtrim (str)
   "Remove trailing whitespace from `STR'."
   (replace-regexp-in-string "[ \t\n]*$" "" str))

+
+(setq delete-by-moving-to-trash t)
+
+
 (setq-default save-place t)
 (setq save-place-file (concat emacsd-tmp "places"))
-(require 'saveplace)

-(global-hl-line-mode +1)
+(require 'saveplace)

 (progn
   (require 'tramp)
@@ -357,7 +428,8 @@ Otherwise, it inserts comment at the end of the line."
 (ac-config-default)

 ;; Org
-(setq org-modules '(org-bibtex))
+;;(require 'kk-orgmode)
+(setq org-modules '(org-bibtex org-docview org-info org-w3m org-toc))

 (setq org-log-done t
       org-completion-use-ido t
@@ -435,12 +507,13 @@ Otherwise, it inserts comment at the end of the line."
 (icomplete-mode +1)

 (set-default 'imenu-auto-rescan t)
-
+;; (require 'kk-smex)
 (smex-initialize)
 (global-set-key "\M-x" 'smex)
 (global-set-key "\C-x \C-m" 'smex)
 (setq smex-save-file (concat emacsd-tmp "smex"))

+;; (require 'kk-yas)
 (require 'yasnippet)
 (yas/global-mode +1)

@@ -460,6 +533,8 @@ Otherwise, it inserts comment at the end of the line."

 (setq org-id-method 'uuidgen)

+(setq org-src-fontify-natively t)
+
 (setq org-completeion-use-ido t)
 (global-set-key "\C-cl" 'org-store-link)
 (global-set-key "\C-ca" 'org-agenda)
@@ -524,7 +599,7 @@ Otherwise, it inserts comment at the end of the line."
 (blink-cursor-mode -1)

 (if (fboundp 'fringe-mode)
-    (fringe-mode 4))
+    (fringe-mode '(1 . 0)))

 (fset 'yes-or-no-p 'y-or-n-p)

@@ -533,7 +608,7 @@ Otherwise, it inserts comment at the end of the line."
 (add-to-list 'safe-local-variable-values '(lexical-binding . t))
 (add-to-list 'safe-local-variable-values '(whitespace-line-column . 80))

-(random t) ;; send the random-number generator
+(random t) ; send the random-number generator

 (progn
   (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode))
@@ -586,8 +661,6 @@ Otherwise, it inserts comment at the end of the line."
       'mew-draft-kill
       'mew-send-hook))

-(set-face-attribute hl-line-face nil :underline t)
-
 ;; coffeescript
 (add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
 (add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
@@ -600,70 +673,57 @@ Otherwise, it inserts comment at the end of the line."
 (require 'soy-mode)
 (add-to-list 'auto-mode-alist '("\\.soy$" . soy-mode))

-(defun clojure-correct-ns ()
-  "Returns the namespace name that the file should have."
- (let* ((nsname ())
-        (dirs (reverse (split-string (buffer-file-name) "/")))
-        (aftersrc nil))
-   (dolist (dir dirs)
-     (when (not aftersrc)
-       (if (or (string= dir "src")
-               (string= dir "test")) (setq aftersrc t)
-         (setq nsname (append nsname (list dir "."))))))
-   (when nsname
-     (replace-regexp-in-string "_" "-"
-                               (substring
-                                (apply 'concat (reverse nsname))
-                                1 -4)))))
-(defun clojure-update-ns ()
-  "Updates the namespace of the current buffer. Useful if a file has been renamed."
-  (interactive)
-  (let ((nsname (clojure-correct-ns)))
-    (when nsname
-      (clojure-find-ns) ;; function defined in clojure-mode
-      (replace-match nsname nil nil nil 4))))
-
-(defun earmuffy (&optional arg)
-  (interactive "P")
-  (let* ((variable (thing-at-point 'sexp))
-         (bounds (bounds-of-thing-at-point 'sexp))
-         (current-point (point))
-         (earmuffed-variable (concat "*" variable "*")))
-    (save-excursion)
-    (kill-region (car bounds) (cdr bounds))
-    ;; unearmuffy
-    (if arg (progn (insert (substring variable 1 (- (length variable) 1)))
-                   (goto-char (- current-point 1)))
-      ;; earmuffy
-      (progn (insert earmuffed-variable)
-             (goto-char (+ current-point 1))))))
-
-(progn
-  (add-hook 'Info-mode-hook
-            (lambda ()
-              (local-set-key "j" 'next-line)
-              (local-set-key "k" 'previous-line)
+(add-hook 'Info-mode-hook
+          (lambda ()
+            (local-set-key "j" 'next-line)
+            (local-set-key "k" 'previous-line)

-              (local-set-key "l" 'forward-word)
-              (local-set-key "h" 'backward-word)
+            (local-set-key "l" 'forward-word)
+            (local-set-key "h" 'backward-word)

-              (local-set-key " " 'Info-scroll-up)
-              (local-set-key "b" 'Info-scroll-down)
+            (local-set-key " " 'Info-scroll-up)
+            (local-set-key "b" 'Info-scroll-down)

-              (local-set-key "g" 'beginning-of-buffer)
-              (local-set-key "G" 'end-of-buffer)
+            (local-set-key "g" 'beginning-of-buffer)
+            (local-set-key "G" 'end-of-buffer)

-              (local-set-key "J" (lambda () (interactive) (scroll-up 1)))
-              (local-set-key "K" (lambda () (interactive) (scroll-down 1)))
-              (local-set-key "H" 'Info-history-back)
-              (local-set-key "L" 'Info-history-forward)
+            (local-set-key "J" (lambda () (interactive) (scroll-up 1)))
+            (local-set-key "K" (lambda () (interactive) (scroll-down 1)))
+            (local-set-key "H" 'Info-history-back)
+            (local-set-key "L" 'Info-history-forward)

-              (local-set-key "o" 'Info-follow-nearest-node)
-              (local-set-key "n" 'Info-next-reference)
-              (local-set-key "N" 'Info-prev-reference))))
+            (local-set-key "o" 'Info-follow-nearest-node)
+            (local-set-key "n" 'Info-next-reference)
+            (local-set-key "N" 'Info-prev-reference)))

 ;;(define-key dired-mode-map "j" 'dired-next-line)
 ;;(define-key dired-mode-map "k" 'dired-previous-line)

+;; (setq auto-install-directoty
+;;      (file-name-as-directory (concat emacsd-vendor "auto-install")))
+;; (add-to-list 'load-path 'auto-install-directory)
+;; (require 'auto-install)
+;; (auto-install-compatibility-setup)
+
+;; NONE: -1,
+;; ERROR: 0,
+;; WARNING: 1,
+;; INFO: 2,
+;; DEBUG: 3
+(setq flymake-log-level 2)
+
+(require 'midnight)
+
+(set-frame-parameter nil 'alpha 92)
+
+(setq scroll-margin 0
+      scroll-conservatively 100000
+      scroll-up-aggressively 0
+      scroll-down-aggressively 0
+      scroll-preserve-screen-position t)
+(set-fill-column 78)
+
 (require 'server)
 (unless (server-running-p) (server-start))
+
+;;; END emacs.d/init.el
diff --git c/emacs.d/modules/.gitkeep i/emacs.d/modules/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git c/emacs.d/modules/kk-btmup.el i/emacs.d/modules/kk-btmup.el
new file mode 100644
index 0000000..27b0d51
--- /dev/null
+++ i/emacs.d/modules/kk-btmup.el
@@ -0,0 +1,36 @@
+;;; coding: utf-8-unix
+
+;; ------------------------------------------------------------------
+;;  CAR [/kɑr/] :: "Contents of the Address part of Register number"
+;; ------------------------------------------------------------------
+;; Lispy % (car (cons x y))
+;; Lispy % => x
+(defun first (x) (car x))
+
+;; ----------------------------------------------------------------------
+;;  CDR [/kʌdər/] :: "Contents of the Decrement part of Register number"
+;; ----------------------------------------------------------------------
+;; Lispy % (cdr (cons x y))
+;; Lispy % => y
+(defun rest (x) (cdr x))
+
+;; ----------------------------------------------------------------------
+;; Compositions
+(defun caar (x) (car (car x)))
+;; >>> (caar '(1 2 3))
+;; >>> => 2
+(defun cadr (x) (car (cdr x)))
+;; >>> (cadr '(1 2 3))
+;; >>> (car (cdr '(1 2 3)))
+;; >>> => 2
+;;;; -------------------------------------------------------------------------
+(defun second (x) (car (cdr x)))
+(defun cddr (x) (cdr (cdr x)))
+(defun cdar (x) (cdr (car x)))
+(defun caaar (x) (car (car (car x))))
+(defun caadr (x) (car (car (cdr x))))
+(defun cadar (x) (car (cdr (car x))))
+(defun third (x) (car (cdr (cdr x))))
+;;;; MISC.
+
+(provide 'kk-btmup)
diff --git c/emacs.d/modules/kk-evil.el i/emacs.d/modules/kk-evil.el
new file mode 100644
index 0000000..461e06e
--- /dev/null
+++ i/emacs.d/modules/kk-evil.el
@@ -0,0 +1,131 @@
+;;; coding: utf-8
+(defun kk::evil-ex ()
+  "settings for evil ex"
+  (setq evil-ex-search-interactive t)
+  (setq evil-ex-search-highlight-all t)
+  (setq evil-ex-substitute-highlight-all t)
+  (setq evil-ex-substitute-interactive-replace t))
+
+(defun kk::evil-setup ()
+  (progn (setq evil-default-state 'normal)
+         (setq evil-auto-indent t)
+         (setq evil-shift-width 4)
+         (setq evil-search-wrap t)
+         (setq evil-find-skip-newlines t)
+         (setq evil-move-cursor-back nil)
+         (setq evil-mode-line-format 'before)
+         (setq evil-esc-delay 0.001)
+         (setq evil-cross-lines t))
+
+  (progn (setq evil-want-C-i-jump t)
+         (setq evil-want-C-u-scroll t)
+         (setq evil-want-fine-undo t)))
+
+(defun kk::evil-emacs-state-in (lst)
+  "LST of modes that should come up in Emacs state."
+  (setq evil-emacs-state-modes 'lst))
+(defun kk::evil-insert-state-in (lst)
+  "LST of modes that should come up in Insert state."
+  (setq evil-insert-state-modes 'lst))
+(defun kk::evil-motion-state-in (lst)
+  "LST of modes that should come up in Motion state."
+  (setq evil-motion-state-modes 'lst))
+
+(defun kk::evil-leader-setup ()
+  (progn (setq evil-leader/leader ",")
+         (setq evil-leader/in-all-states t)))
+
+(kk::evil-setup)
+(kk::evil-leader-setup)
+
+(require 'evil-leader)
+(require 'evil)
+(require 'surround)
+(evil-mode t)
+(global-surround-mode t)
+
+(defun kk::set-evil-state-tags ()
+  (setq evil-normal-state-tag
+        (propertize " N " 'face '((:background "grey10" :foreground "green"))))
+  (setq evil-emacs-state-tag
+        (propertize " E " 'face '((:background "grey10" :foreground "purple"))))
+  (setq evil-insert-state-tag
+        (propertize " I " 'face '((:background "grey10" :foreground "red"))))
+  (setq evil-motion-state-tag
+        (propertize " M " 'face '((:background "grey10" :foreground "blue"))))
+  (setq evil-operator-state-tag
+        (propertize " O " 'face '((:background "grey10" :foreground "orange"))))
+  (setq evil-visual-state-tag
+        (propertize " V " 'face '((:background "grey10" :foreground "grey80")))))
+
+;; evil cursors
+(defun kk::set-evil-cursors ()
+  (setq evil-default-cursor '("white" hbar))
+  (setq evil-normal-state-cursor '("gray50" hbar))
+  (setq evil-insert-state-cursor '("gray90" bar))
+  (setq evil-visual-state-cursor '("gray20" box))
+  (setq evil-motion-state-cursor '("black" hbar))
+  (setq evil-replace-state-cursor '("red" hollow))
+  (setq evil-operator-state-cursor '("black" box)))
+
+(defun kk::evil-nmap ()
+  (progn (evil-define-key 'normal global-map
+           (kbd "SPC") 'evil-toggle-fold
+           ",e" 'find-file))
+
+  (progn (evil-define-key 'normal emacs-lisp-mode-map
+           (kbd "E") 'eval-buffer
+           (kbd "=") 'eval-last-sexp))
+
+  (progn (evil-define-key 'normal org-mode-map
+           "za" 'org-cycle
+           "zA" 'org-shifttab
+           "zm" 'hide-body
+           "zr" 'show-all
+           "zo" 'show-subtree
+           "zO" 'show-all
+           "zc" 'hide-subtree
+           "zC" 'hide-all
+           (kbd "RET") 'org-open-at-point
+           (kbd "M-j") 'org-shiftleft
+           (kbd "M-k") 'org-shiftright
+           (kbd "M-H") 'org-metaleft
+           (kbd "M-J") 'org-metadown
+           (kbd "M-K") 'org-metaup
+           (kbd "M-L") 'org-metaright))
+
+  (progn (evil-define-key 'normal Info-mode-map
+           "j" 'next-line
+           "k" 'previous-line
+           "l" 'forward-word
+           "h" 'backward-word
+
+           "H" 'Info-history-back
+           "L" 'Info-history-forward
+
+           "n" 'Info-next-reference
+           "N" 'Info-prev-reference
+
+           (kbd "SPC") 'Info-scroll-down
+           (kbd "M-SPC") 'Info-scroll-up)))
+
+(defun kk::evil-imap ()
+  (progn (evil-define-key 'insert global-map
+           (kbd "RET") 'newline-and-indent))
+  (progn (evil-define-key 'insert org-mode-map
+           (kbd "M-j") 'org-shiftleft
+           (kbd "M-k") 'org-shiftright
+           (kbd "M-H") 'org-metaleft
+           (kbd "M-J") 'org-metadown
+           (kbd "M-K") 'org-metaup
+           (kbd "M-L") 'org-metaright)))
+
+(kk::set-evil-state-tags)
+(kk::set-evil-cursors)
+
+(kk::evil-nmap)
+(kk::evil-imap)
+
+
+(provide 'kk-evil)
+
diff --git c/emacs.d/modules/kk-evil.el~ i/emacs.d/modules/kk-evil.el~
new file mode 100644
index 0000000..013c292
--- /dev/null
+++ i/emacs.d/modules/kk-evil.el~
@@ -0,0 +1,113 @@
+(unless (require 'evil nil t)
+  (viper-mode +1))
+
+(setq evil-default-state 'normal
+      evil-auto-indent t
+      evil-shift-width 4
+      evil-search-wrap t
+      evil-find-skip-newlines t
+      evil-move-cursor-back nil
+      evil-cross-lines t)
+
+(setq evil-want-C-u-scroll t
+      evil-want-C-w-in-emacs-state t
+      evil-want-fine-undo t)
+
+
+(setq evil-leader/leader ","
+      evil-leader/in-all-states t)
+
+(require 'evil-leader)
+(require 'evil)
+(require 'surround)
+
+(evil-mode +1)
+(global-surround-mode +1)
+
+(setq evil-normal-state-tag (propertize " N "
+                                        'face '((:background "black" :foreground "green"))))
+(setq evil-emacs-state-tag (propertize " E " 'face '((:background "black" :foreground "purple"))))
+
+(setq
+ evil-insert-state-tag (propertize "I" 'face '((:background "red")))
+ evil-motion-state-tag (propertize "M" 'face '((:background "blue")))
+ evil-operator-state-tag (propertize "O" 'face '((:background "orange")))
+ evil-visual-state-tag (propertize "V" 'face '((:background "grey80" :foreground "black"))))
+  ;; evil cursors
+
+(setq evil-default-cursor '("white" hbar))
+(setq evil-normal-state-cursor '("gray50" hbar))
+(setq evil-insert-state-cursor '("gray90" bar))
+(setq evil-visual-state-cursor '("gray20" box))
+(setq evil-motion-state-cursor '("black" hbar))
+(setq evil-replace-state-cursor '("red" hollow))
+(setq evil-operator-state-cursor '("black" box))
+
+(define-key evil-normal-state-map (kbd "SPC") 'evil-toggle-fold)
+(define-key evil-normal-state-map ",e" 'find-file)
+(define-key evil-normal-state-map "`" 'smex)
+
+(evil-declare-key 'normal emacs-lisp-mode-map
+                  (kbd "E") 'eval-buffer
+                  (kbd "=") 'eval-last-sexp)
+
+(evil-define-key 'normal org-mode-map
+  (kbd "RET") 'org-open-at-point
+  "za"        'org-cycle
+  "zA"        'org-shifttab
+  "zm"        'hide-body
+  "zr"        'show-all
+  "zo"        'show-subtree
+  "zO"        'show-all
+  "zc"        'hide-subtree
+  "zC"        'hide-all
+  (kbd "M-j") 'org-shiftleft
+  (kbd "M-k") 'org-shiftright
+  (kbd "M-H") 'org-metaleft
+  (kbd "M-J") 'org-metadown
+  (kbd "M-K") 'org-metaup
+  (kbd "M-L") 'org-metaright)
+(evil-define-key 'normal orgstruct-mode-map
+  (kbd "RET") 'org-open-at-point
+  "za"        'org-cycle
+  "zA"        'org-shifttab
+  "zm"        'hide-body
+  "zr"        'show-all
+  "zo"        'show-subtree
+  "zO"        'show-all
+  "zc"        'hide-subtree
+  "zC"        'hide-all
+  (kbd "M-j") 'org-shiftleft
+  (kbd "M-k") 'org-shiftright
+  (kbd "M-H") 'org-metaleft
+  (kbd "M-J") 'org-metadown
+  (kbd "M-K") 'org-metaup
+  (kbd "M-L") 'org-metaright)
+(evil-define-key 'insert org-mode-map
+  (kbd "M-j") 'org-shiftleft
+  (kbd "M-k") 'org-shiftright
+  (kbd "M-H") 'org-metaleft
+  (kbd "M-J") 'org-metadown
+  (kbd "M-K") 'org-metaup
+  (kbd "M-L") 'org-metaright)
+(evil-define-key 'insert orgstruct-mode-map
+  (kbd "M-j") 'org-shiftleft
+  (kbd "M-k") 'org-shiftright
+  (kbd "M-H") 'org-metaleft
+  (kbd "M-J") 'org-metadown
+  (kbd "M-K") 'org-metaup
+  (kbd "M-L") 'org-metaright)
+
+
+
+
+
+
+
+
+
+
+
+
+
+(provide 'kk-evil)
diff --git c/emacs.d/modules/kk-fns.el i/emacs.d/modules/kk-fns.el
new file mode 100644
index 0000000..cbe77d4
--- /dev/null
+++ i/emacs.d/modules/kk-fns.el
@@ -0,0 +1,61 @@
+;;; coding: utf-8-unix
+;; encoding: UTF-8
+
+;;;; Conversions (->)
+;;; Type
+(defun lst->vec (lst) (coerce lst 'vector))
+(defun vec->lst (vec) (coerce vec 'list))
+;;; String
+(defun ->relpath (abspath)
+  (when (file-exists-p abspath)
+    (let ((home (expand-file-name (concat "~/" ""))))
+      (if (string-match (concat "^" home) abspath)
+          (replace-match "~/" t t abspath) abspath))))
+;;;; Predicates (?)
+(defun is-float? (obj) (and (numberp obj) (not (integerp obj))))
+(defun is-positive? (number) (> number 0))
+(defun is-negative? (number) (< number 0))
+;;; Aliases
+(defun is-list? (o) (listp o))
+(defun is-hash-table? (o) (hash-table-p o))
+;;;; CL
+;; @see built-in: cl.el
+;; are here to be used safely
+;;; Simple Functions
+
+;;; --------------------------------------------------------------------------
+;;;; =========================================================================
+;;; --------------------------------------------------------------------------
+;; CAR [/kɑr/] :: "Contents of the Address part of Register number"
+(defun first (x) (car x))
+;; >>> (car (cons x y))
+;; >>> => x
+;;; --------------------------------------------------------------------------
+;; CDR [/kʌdər/] :: "Contents of the Decrement part of Register number"
+(defun rest (x) (cdr x))
+;; >>> (cdr (cons x y))
+;; >>> => y
+;;; --------------------------------------------------------------------------
+;;;; =========================================================================
+;;; --------------------------------------------------------------------------
+(defun caar (x) (car (car x)))
+;; >>> (caar '(1 2 3))
+;; >>> => 2
+;;;; -------------------------------------------------------------------------
+(defun cadr (x) (car (cdr x)))
+;; >>> (cadr '(1 2 3))
+;; >>> (car (cdr '(1 2 3)))
+;; >>> => 2
+;;;; -------------------------------------------------------------------------
+(defun second (x) (car (cdr x)))
+(defun cddr (x) (cdr (cdr x)))
+(defun cdar (x) (cdr (car x)))
+(defun caaar (x) (car (car (car x))))
+(defun caadr (x) (car (car (cdr x))))
+(defun cadar (x) (car (cdr (car x))))
+(defun third (x) (car (cdr (cdr x))))
+;;;; MISC.
+
+
+;;;; =========================================================================
+(provide 'kk-fns)
diff --git c/emacs.d/modules/kk-macros.el i/emacs.d/modules/kk-macros.el
new file mode 100644
index 0000000..75c254c
--- /dev/null
+++ i/emacs.d/modules/kk-macros.el
@@ -0,0 +1,46 @@
+;;;
+
+(defmacro comment (&rest body)
+  "Ignores body, yields nil."
+  nil)
+
+(defun mean (values)
+  (/ (reduce '+ values)
+     (float (length values))))
+(defun square (x)
+  (* x x))
+
+
+
+
+(defmacro ->> (&rest body)
+  (let ((result (pop body)))
+    (dolist (form body result)
+      (setq result (append form (list result))))))
+(defmacro -> (&rest body)
+  (let ((result (pop body)))
+    (dolist (form body result)
+      (setq result (append (list (car form) result)
+                           (cdr form))))))
+
+
+
+
+
+
+
+
+
+(defmacro require-exec (feat &optional &rest body)
+  "requires FEAT and executes BODY on success."
+  (declare (indent 1))
+  `(if (require ,feat nil 'noerror) (progn ,@body)
+     (message (format "require %s FAILED." ,feat))))
+(defmacro load-exec (file &optional &rest body)
+  "loads FILE and executes BODY on success."
+  (declare (indent 1))
+  `(if (load ,file t) (progn ,@body)
+     (message (format "load %s FAILED." ,file))))
+
+
+(provide 'kk-macros)
diff --git c/emacs.d/modules/kk-orgmode.el i/emacs.d/modules/kk-orgmode.el
new file mode 100644
index 0000000..828144b
--- /dev/null
+++ i/emacs.d/modules/kk-orgmode.el
@@ -0,0 +1,5 @@
+;;; .emacs.d/modules/kk-orgmode.el
+
+;;;
+(provide 'kk-orgmode)
+
diff --git c/emacs.d/modules/kk-predicates.el i/emacs.d/modules/kk-predicates.el
new file mode 100644
index 0000000..e770cea
--- /dev/null
+++ i/emacs.d/modules/kk-predicates.el
@@ -0,0 +1,16 @@
+;;; .emacs.d/modules/kk-predicates.el
+
+(defun darwin-p () (eq system-type 'darwin))
+(defun linux-p () (eq system-type 'gnu/linux))
+(defun ns-p () (featurep 'ns))
+
+(setq darwin-p (eq system-type 'darwin)
+      is-darwin darwin-p
+      ns-p (featurep 'ns)
+      has-ns ns-p
+      carbon-p (eq window-system 'mac)
+      linux-p (eq system-type 'gnu/linux))
+
+
+
+(provide 'kk-predicates)
diff --git c/emacs.d/modules/kk-progmode.el i/emacs.d/modules/kk-progmode.el
new file mode 100644
index 0000000..f74c744
--- /dev/null
+++ i/emacs.d/modules/kk-progmode.el
@@ -0,0 +1,4 @@
+
+(autoload 'linum-mode "linum" "mode for line numbers" t)
+
+(provide 'kk-progmode)
diff --git c/emacs.d/modules/kk-ui.el i/emacs.d/modules/kk-ui.el
new file mode 100644
index 0000000..acfeaf9
--- /dev/null
+++ i/emacs.d/modules/kk-ui.el
@@ -0,0 +1 @@
+(provide 'kk-ui)
diff --git c/emacs.d/modules/kk-utils.el i/emacs.d/modules/kk-utils.el
new file mode 100644
index 0000000..586e24c
--- /dev/null
+++ i/emacs.d/modules/kk-utils.el
@@ -0,0 +1,56 @@
+;;; .emacs.d/modules/kk-utils.el --- various utils
+
+(defun find-func-doit (symbol type switch-fn)
+  "Find Emacs Lisp SYMBOL in a buffer and display it.
+
+TYPE is nil to search for a function definition, or else `defvar' or `defface'.
+The variable `find-function-recenter-line' controls how to recenter the display.
+SWITCH-FN is the function to call to display and select the buffer.
+See also `find-function-after-hook'.
+Set mark before moving, if the buffer already existed."
+  (let* ((orig-point (point))
+         (orig-buf (window-buffer))
+         (orig-buffers (buffer-list))
+         (buffer-point (save-excursion (find-definition-noselect symbol type)))
+         (new-buf (car buffer-point))
+         (new-point (cdr buffer-point)))
+    (when buffer-point
+      (when (memq new-buf orig-buffers) (push-mark orig-point))
+      (funcall switch-fn new-buf)
+      (widen)
+      (when new-point (goto-char new-point))
+      (recenter find-function-recenter-line)
+      (run-hooks 'find-function-after-hook))))
+
+(defun in-mode? (mode)
+  (eq major-mode mode))
+(defun empty? (x)
+  (typecase x
+    (string (string= x ""))
+    (list (null x))
+    (vector (= (length x) 0))))
+(defun darwin? ()
+  (eq system-type 'darwin))
+(defun linux? ()
+  (eq system-type 'gnu/linux))
+(defun has-ns? ()
+  (featurep 'ns))
+
+(defun add-to-hook (hook fns)
+  "Add list of functions to HOOK."
+  (dolist (fn fns)
+    (add-hook hook fn)))
+(defun add-to-hooks (fn hooks)
+  "Add FN to list of HOOKS"
+  (dolist (hook hooks)
+    (add-hook hook fn)))
+(defun add-all-to-hook (hook &rest fns)
+  "Add FNS to HOOK."
+  (add-to-hook hook fns))
+
+
+
+
+
+
+(provide 'kk-util)
diff --git c/sandbox/ruby/fizzbuzz.rb i/sandbox/ruby/fizzbuzz.rb
index 88c1226..eb198cc 100644
--- c/sandbox/ruby/fizzbuzz.rb
+++ i/sandbox/ruby/fizzbuzz.rb
@@ -1,32 +1,35 @@
 #!/usr/bin/env ruby
 # -*- coding: utf-8-unix -*-

+max = ARGV[0]
+
 class Numeric
+  def fizzbuzz?
+    self % 3 == 0 and self % 5 == 0
+  end
   def fizz?
     not fizzbuzz? and self % 3 == 0
   end
   def buzz?
     not fizzbuzz? and self % 5 == 0
   end
-  def fizzbuzz?
-    self % 3 == 0 and self % 5 == 0
-  end
-
   def fizzbuzz
     if fizz?
-      "Fizz"
+      'Fizz'
     elsif buzz?
-      "Buzz"
+      'Buzz'
     elsif fizzbuzz?
-      "FizzBuzz"
+      'FizzBuzz'
     else
       self.to_s
     end
   end
 end

-if __FILE__ == $0
-  (1..100).each {
-    |x| puts x.fizzbuzz
-  }
-end
+# if __FILE__ == $0
+#   (1..100).each {
+#     |x| puts x.fizzbuzz
+#   }
+# end
+
+(1..100).each {|x| puts x.fizzbuzz}
diff --git c/zsh/zshrc i/zsh/zshrc
index 05a97a8..6681037 100644
--- c/zsh/zshrc
+++ i/zsh/zshrc
@@ -607,6 +607,11 @@ __aliases() {
         alias _='sudo'
     }
     set_alias_common;
+    set_alias_rubydev() {
+      alias be='bundle exec'
+      alias r='rails'
+    }
+    set_alias_rubydev;

     set_alias_edit() {
         # editing
@@ -1041,8 +1046,9 @@ export GISTY_DIR="$HOME/etc/gists"
 function nkfsw() {
   nkf Sw $1
 }
-
-alias railsnew='rails_apps_composer --defaults=~/.rac'
+function railsnew() {
+  rails_apps_composer --defaults=~/.rac $1
+}

 typeset -gxU PATH=$PATH # remove dupes in path
 unset _zsh_user_config_dir
[from now] 2012/06/01 09:30:41

diff --git c/emacs.d/modules/kk-evil.el~ i/emacs.d/modules/kk-evil.el~
deleted file mode 100644
index 013c292..0000000
--- c/emacs.d/modules/kk-evil.el~
+++ /dev/null
@@ -1,113 +0,0 @@
-(unless (require 'evil nil t)
-  (viper-mode +1))
-
-(setq evil-default-state 'normal
-      evil-auto-indent t
-      evil-shift-width 4
-      evil-search-wrap t
-      evil-find-skip-newlines t
-      evil-move-cursor-back nil
-      evil-cross-lines t)
-
-(setq evil-want-C-u-scroll t
-      evil-want-C-w-in-emacs-state t
-      evil-want-fine-undo t)
-
-
-(setq evil-leader/leader ","
-      evil-leader/in-all-states t)
-
-(require 'evil-leader)
-(require 'evil)
-(require 'surround)
-
-(evil-mode +1)
-(global-surround-mode +1)
-
-(setq evil-normal-state-tag (propertize " N "
-                                        'face '((:background "black" :foreground "green"))))
-(setq evil-emacs-state-tag (propertize " E " 'face '((:background "black" :foreground "purple"))))
-
-(setq
- evil-insert-state-tag (propertize "I" 'face '((:background "red")))
- evil-motion-state-tag (propertize "M" 'face '((:background "blue")))
- evil-operator-state-tag (propertize "O" 'face '((:background "orange")))
- evil-visual-state-tag (propertize "V" 'face '((:background "grey80" :foreground "black"))))
-  ;; evil cursors
-
-(setq evil-default-cursor '("white" hbar))
-(setq evil-normal-state-cursor '("gray50" hbar))
-(setq evil-insert-state-cursor '("gray90" bar))
-(setq evil-visual-state-cursor '("gray20" box))
-(setq evil-motion-state-cursor '("black" hbar))
-(setq evil-replace-state-cursor '("red" hollow))
-(setq evil-operator-state-cursor '("black" box))
-
-(define-key evil-normal-state-map (kbd "SPC") 'evil-toggle-fold)
-(define-key evil-normal-state-map ",e" 'find-file)
-(define-key evil-normal-state-map "`" 'smex)
-
-(evil-declare-key 'normal emacs-lisp-mode-map
-                  (kbd "E") 'eval-buffer
-                  (kbd "=") 'eval-last-sexp)
-
-(evil-define-key 'normal org-mode-map
-  (kbd "RET") 'org-open-at-point
-  "za"        'org-cycle
-  "zA"        'org-shifttab
-  "zm"        'hide-body
-  "zr"        'show-all
-  "zo"        'show-subtree
-  "zO"        'show-all
-  "zc"        'hide-subtree
-  "zC"        'hide-all
-  (kbd "M-j") 'org-shiftleft
-  (kbd "M-k") 'org-shiftright
-  (kbd "M-H") 'org-metaleft
-  (kbd "M-J") 'org-metadown
-  (kbd "M-K") 'org-metaup
-  (kbd "M-L") 'org-metaright)
-(evil-define-key 'normal orgstruct-mode-map
-  (kbd "RET") 'org-open-at-point
-  "za"        'org-cycle
-  "zA"        'org-shifttab
-  "zm"        'hide-body
-  "zr"        'show-all
-  "zo"        'show-subtree
-  "zO"        'show-all
-  "zc"        'hide-subtree
-  "zC"        'hide-all
-  (kbd "M-j") 'org-shiftleft
-  (kbd "M-k") 'org-shiftright
-  (kbd "M-H") 'org-metaleft
-  (kbd "M-J") 'org-metadown
-  (kbd "M-K") 'org-metaup
-  (kbd "M-L") 'org-metaright)
-(evil-define-key 'insert org-mode-map
-  (kbd "M-j") 'org-shiftleft
-  (kbd "M-k") 'org-shiftright
-  (kbd "M-H") 'org-metaleft
-  (kbd "M-J") 'org-metadown
-  (kbd "M-K") 'org-metaup
-  (kbd "M-L") 'org-metaright)
-(evil-define-key 'insert orgstruct-mode-map
-  (kbd "M-j") 'org-shiftleft
-  (kbd "M-k") 'org-shiftright
-  (kbd "M-H") 'org-metaleft
-  (kbd "M-J") 'org-metadown
-  (kbd "M-K") 'org-metaup
-  (kbd "M-L") 'org-metaright)
-
-
-
-
-
-
-
-
-
-
-
-
-
-(provide 'kk-evil)