 ;; (global-auto-revert-mode 1)
 
 ;; 自動保存ファイルの保存先ディレクトリ
-(defconst emacs-bk-dir
-  (concat temporary-file-directory
-          "emacs-bk-" (number-to-string (user-uid)) "/"))
-(mkdir emacs-bk-dir t) ;; TODO do mkdir recursively
+(defconst emacs-bk-dir "~/.emacs-bk/")
+(mkdir emacs-bk-dir t)
 
 ;; 自動保存機能
 (setq auto-save-default t

   ;; *scratch* の major-mode
   initial-major-mode 'markdown-mode
   ;; *scratch* の初期文字列
   initial-scratch-message "Scratch\n========\n\n")
  )

;; shell-script-mode
(add-to-list 'auto-mode-alist '("\\.zsh\\'" . shell-script-mode))

;; yaml-mode
(kui/with-lib "yaml-mode"
  ;; ...
  )

;; ruby-mode
(kui/with-lib "ruby-mode"
  (add-to-list 'auto-mode-alist '("\\.gemspec\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("/config\\.ru\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\(Rake\\|Gem\\|Thor\\|Berks\\|Vagrant\\)file\\'" . ruby-mode))
  (add-to-list 'auto-mode-alist '("\\.builder\\'" . ruby-mode)))
(kui/after-loaded "ruby-mode"
  (setq ruby-deep-indent-paren nil)
  (defun kui/ruby-init ()
    (flycheck-mode)

    (insert initial-scratch-message)))

(defun kui/active-minor-mode-p (mode)
  "Return MODE if MODE was activate on the current buffer, \
but if not, return nil."
  (not (and (boundp mode)
            (symbol-value mode)
            (fboundp (or (get mode :minor-mode-function) mode)))))

(defun kui/current-minor-modes ()
  "Return minor modes on the current buffer."
  (remove-if 'kui/active-minor-mode-p
             minor-mode-list))

(defun kui/find-font (&rest fonts)
  "Return an existing font which was find at first in FONTS."
  (cl-find-if (lambda (f)
                (find-font (font-spec :name f)))
              fonts))

(defun kui/revert-buffer ()
  "Execute `revert-buffer' without confimations if it was not edited."
  (interactive)
  (if (not (buffer-modified-p))
      (let ()
