(let ((additions
'("~/"
"~/rin/rhtml"
"~/rin/rel"
"~/rin/elunit"
"~/rin/test"
"~/rin"
"~/.emacs.d"
"~/.emacs.d/ecb"
"~/.emacs.d/nxml-mode"
"~/.emacs.d/psgml"
"~/.emacs.d/mmm-mode"
"~/.emacs.d/color-theme"
)))
(setq load-path (append load-path
(mapcar 'expand-file-name
additions))))

(column-number-mode)

(defun other-window-make-80 (&optional arg)
(interactive)
(prog1
(other-window 1)
(when (< (window-width) 80)
(enlarge-window-horizontally (- 80 (window-width))))))
(define-key global-map "\C-xo" 'other-window-make-80)

;;(add-to-list 'load-path "~/el4r/usr/share/emacs/site-lisp")
;;(require 'el4r)
;;(el4r-boot)

;;; Fixes
;; View-quit sucks-ass
(setq view-exit-action 'burry-buffer)

;;; General
;; External pasting
(when (fboundp 'x-cut-buffer-or-selection-value)
(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value))

;; Scroll with mouse-wheel
(mwheel-install)

(require 'column-marker)
(column-marker-1 78)

(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-fischmeister)

;;; ECB
(load-file "~/.emacs.d/cedet/common/cedet.el")
(setq semantic-idle-scheduler-idle-time 432000) ;fix CPU eating issue
;; Enabling various SEMANTIC minor modes. See semantic/INSTALL for more ideas.
;; Select one of the following
;;(semantic-load-enable-code-helpers)
;;(semantic-load-enable-guady-code-helpers)
(semantic-load-enable-excessive-code-helpers)
;; Enable this if you develop in semantic, or develop grammars
;; (semantic-load-enable-semantic-debugging-helpers)
(require 'ecb)

;;; Ruby-Mode
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(setq auto-mode-alist (cons '("\\.rb$" . ruby-mode) auto-mode-alist))
;; (setq auto-mode-alist (cons '("\\.rhtml$" . html-mode) auto-mode-alist))

;;(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
;;(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)
;;(defun try-complete-abbrev (old)
;; (if (expand-abbrev) t nil))

(defun try-complete-abbrev (old)
nil)

(setq hippie-expand-try-functions-list
'(try-complete-abbrev))
;; try-complete-file-name
;; try-expand-dabbrev))
(defalias 'yes-or-no-p 'y-or-n-p)

;;; PSGML
;;(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
;;(autoload 'xml-mode "psgml" "Major mode to edit XML files." t)

;; NXML
;; NXhtml
;;(load "~/.emacs.d/nxml-mode/nxml-mode.el")
;; requires emacs 22
;;(load "~/.emacs.d/nxml-mode/rng-auto.el")
;;(load "~/.emacs.d/nxhtml/nxhtml-autoload")

;;; ERB
;; (require 'mmm-mode)
;; (require 'mmm-auto)
;; (setq mmm-global-mode 'maybe)
;; (setq mmm-submode-decoration-level 2)
;; (set-face-background 'mmm-output-submode-face "LightGrey")
;; (set-face-background 'mmm-code-submode-face "MediumSlateBlue")
;; (set-face-background 'mmm-comment-submode-face "DarkOliveGreen")
;; (mmm-add-classes
;; '((erb-code
;; :submode ruby-mode
;; :match-face (("<%#" . mmm-comment-submode-face)
;; ("<%=" . mmm-output-submode-face)
;; ("<%" . mmm-code-submode-face))
;; :front "<%[#=]?"
;; :back "-?%>"
;; :insert ((?% erb-code nil @ "<%" @ " " _ " " @ "%>" @)
;; (?# erb-comment nil @ "<%#" @ " " _ " " @ "%>" @)
;; (?= erb-expression nil @ "<%=" @ " " _ " " @ "%>" @))
;; )))
;; (add-hook 'html-mode-hook
;; (lambda ()
;; (setq mmm-classes '(erb-code))
;; (mmm-mode-on)))
;; (add-to-list 'auto-mode-alist '("\\.rhtml$" . html-mode))

;;; Rails-Mode
;; (require 'rails)
;; (defun rails-find-and-goto-error ()
;; "Finds error in rails html log go on error line"
;; (interactive)
;; (search-forward-regexp "RAILS_ROOT: \\([^<]*\\)")
;; (let ((rails-root (concat (match-string 1) "/")))
;; (search-forward "id=\"Application-Trace\"")
;; (search-forward "RAILS_ROOT}")
;; (search-forward-regexp "\\([^:]*\\):\\([0-9]+\\)")
;; (let ((file (match-string 1))
;; (line (match-string 2)))
;; ;(kill-buffer (current-buffer))
;; (message
;; (format "Error found in file \"%s\" on line %s. " file line))
;; (find-file (concat rails-root file))
;; (goto-line (string-to-int line)))))

(put 'narrow-to-region 'disabled nil)


(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ecb-options-version "2.32")
'(emacs-lisp-docstring-fill-column 75)
'(indent-tabs-mode nil)
'(scroll-step 2)
'(tool-bar-mode nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)