 ;;----------------------------------------------------------------------------
 ;; ECB (Emacs Code Browser)
 ;;----------------------------------------------------------------------------
-; Change default location of semantic.cache files
-(setq semanticdb-default-save-directory (expand-file-name "~/.semanticdb"))
-(require 'cedet)
-(require 'ecb-autoloads)
+(when *ecb-support-enabled*
+  ;; Change default location of semantic.cache files
+  (setq semanticdb-default-save-directory (expand-file-name "~/.semanticdb"))
+  (unless (file-directory-p semanticdb-default-save-directory)
+    (make-directory semanticdb-default-save-directory))
+  (require 'cedet)
+  (require 'ecb-autoloads))
 
 
 ;;----------------------------------------------------------------------------

;;----------------------------------------------------------------------------
;; Set load path
;;----------------------------------------------------------------------------

(setq ruby-electric-expand-delimiters-list nil)  ; Only use ruby-electric for adding 'end'
(add-hook 'ruby-mode-hook
          (lambda () (ruby-electric-mode)))
(when *vi-emulation-support-enabled*
  (add-hook 'ruby-mode-hook (lambda () (viper-change-state-to-vi))))

(add-auto-mode 'ruby-mode "Rakefile$" "\.rake$" "\.rxml$" "\.rjs" ".irbrc")
(add-auto-mode 'html-mode "\.rhtml$")
