summaryrefslogtreecommitdiffstats
path: root/emacs
blob: 52357eff1fd02593e0ecf155705df6445a671635 (plain)
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
159
160
161
162
163
164
165
166
167
168
;; -*- mode: Emacs-Lisp; -*-
(add-to-list 'load-path "~/.emacs.d")
(add-to-list 'load-path "~/.emacs.d/naquadah-theme")
(add-to-list 'load-path "~/.emacs.d/auto-complete-clang")

;; Requires
(require 'uniquify)
(require 'autopair)
(require 'color-theme)
(require 'flymake)
(require 'color-theme-gruber-darker)
(require 'minimap)
(require 'column-marker)
(require 'color-theme-weirdness)
(require 'auto-complete-clang)

;; Auto complete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)

;; Autoloads
(autoload 'vala-mode
  "vala-mode.elc"    "A Major mode for editing Vala files"        t)
(autoload 'csharp-mode
  "csharp-mode.elc"  "A Major mode for editing C# files"          t)
(autoload 'javascript-mode
  "javascript.elc"   "A Major mode for editing JavaScript files"  t)
(autoload 'sqlplus-mode
  "sqlplus.elc"      "A Major mode for communicating with Oracle" t)
(autoload 'batch-mode
  "batch-mode.elc"   "A Major mode for editing Batch files"       t)
(autoload 'rainbow-mode
  "rainbow-mode.elc" "A Minor mode for showing colors inline"     t)
(autoload 'lua-mode
  "lua-mode.elc"     "A Major mode for editing Lua files"         t)

;; Platform specifics
(if (eq system-type 'gnu/linux)         ; if we're running linux
    (set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))

;; Variables
(setq
 inhibit-startup-message t              ; don't show welcom screen
 require-final-newline t                ; always append a newline to a file, if
                                        ; it doesn't have one
 font-lock-maximum-decoration t         ; denotes my interest in maximum
                                        ; possible fontification
 uniquify-buffer-name-style 'reverse    ; reverse uniquify file names
 backup-directory-alist `((".*" . ,temporary-file-directory))
                                        ; backup file location
 auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
                                        ; autosave file location
 inhibit-default-init t)
(setq-default indent-tabs-mode nil)     ; spaces, no tabs

(fset 'yes-or-no-p 'y-or-n-p)           ; switch yes or no answers to y or n
                                        ; answers

;; Mode settings
(        tool-bar-mode     -1)          ; no toolbar
(        menu-bar-mode     -1)          ; no menu
(     line-number-mode     -1)          ; don't show line numbers in splitter
(    global-linum-mode      t)          ; show line numbers in gutter
(   column-number-mode      t)          ; show column numbers in splitter
(global-font-lock-mode      t)          ; show syntax highlighting
(      show-paren-mode      t)          ; show matching parens
( autopair-global-mode       )          ; enable autopair mode
(delete-selection-mode      t)          ; delete selection upon typing
(global-auto-complete-mode -1)          ; don't enable autocomplete for
                                        ; everything

;; Keybindings
(global-set-key "\C-m"  'newline-and-indent) ; Automatically indent on newline
(global-set-key (kbd "C-x n r")    'narrow-to-region            )
(global-set-key [C-tab]            'hs-toggle-hiding            )
(global-set-key (kbd "<f9>")       'compile)

;; File associations
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
(add-to-list 'auto-mode-alist '("\\.cs$"   . csharp-mode))
(add-to-list 'auto-mode-alist '("\\.bat$"  . batch-mode))
(add-to-list 'auto-mode-alist '("\\.lua$"  . lua-mode))

(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))

(add-to-list 'compilation-finish-functions 'my-comp-finish-function)

;; Color theme
(require 'naquadah-theme)

;; Test for frame fonts
(defun setup-system-frame-colours (&rest frame)
  (let ((f (if (car frame)
               (car frame)
             (selected-frame))))
    (progn
      (set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))))
(require 'server)
(defadvice server-create-window-system-frame
  (after set-system-frame-colours ())
  "Set custom frame colours when creating the first frame on a display"
  (message "Running after frame-initialize")
  (setup-system-frame-colours))
(ad-activate 'server-create-window-system-frame)
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)

;; Hooks
(add-hook 'find-file-hook 'flymake-find-file-hook)
(add-hook 'after-save-hook
          (lambda ()
            (setq fname (buffer-file-name))
            (setq suffix (file-name-extension fname))

            (if (string-equal suffix "el")
                (byte-compile-file fname))))
;;; C
(add-hook 'c-mode-hook
          (lambda ()
            (hs-minor-mode t)
            (column-marker-1 80)
;            (auto-complete-mode)
;            (setq ac-sources '(ac-source-clang))
            ))
;;; CSS
(add-hook 'css-mode-hook
          (lambda ()
            (rainbow-mode)))
;;; Emacs Lisp
(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (auto-complete-mode t)))
;;; Interactive Lisp
(add-hook 'lisp-interaction-mode-hook
          (lambda ()
            (auto-complete-mode t)))
;;; Org
;(add-hook 'org-mode-hook
;          (lambda ()
;            (flyspell-mode 1)
;            (auto-fill-mode 1)
;            (message "org-mode started")))

(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.
)
(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.
)


;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
    (load
     (expand-file-name "~/.emacs.d/elpa/package.el"))
  (package-initialize))