1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
(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.
 )