summaryrefslogtreecommitdiffstats
path: root/dotemacs/.emacs
blob: 9d928fcd6fa183fadb9e5cb3f61e5e7e85126e0c (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
(add-to-list 'load-path "~/.emacs.d")

;; Requires
(require 'paren)
(require 'uniquify)
(require 'autopair)
(require 'color-theme)
(require 'flymake)

;; 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)

;; Functions
(defun what-face (pos)
  "Find out which face the current position uses"
  (interactive "d")
  (let ((face (or (get-char-property (point) 'read-face-name)
                  (get-char-property (point) 'face))))
    (if face (message "Face: %s" face) (message "No face at %d" pos))))

(defun my-comp-finish-function (buf str)
  (if (string-match "exited abnormally" str)
      ;; there were errors
      (message "compilation errors, press C-x ` to visit")
    ;; no errors, make the compilation window go away in 0.5 seconds
    (run-at-time 0.5 nil 'delete-windwos-on buf)
    (message "NO COMPILATION ERRORS!")))

;; Platform specifics
(if (eq system-type 'gnu/linux) ; if we're running linux
    (set-frame-font "-xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-*"))

;; 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 filelocation
 auto-save-file-name-transforms `((".*" ,temporary-file-directory t))) ; autosave file location

(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

;; Keybindings
(global-set-key "\C-m" 'newline-and-indent) ; Automatically indent on newline

;; 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 '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 'color-theme-weirdness)
(color-theme-weirdness)

;; Hooks
(add-hook 'find-file-hook 'flymake-find-file-hook)