-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
135 lines (116 loc) · 5.38 KB
/
.emacs
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
;; TODO: Publish .emacs to a git repo
;; My ~/.emacs file - asadgharighi`
(require 'package)
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(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.
'(blink-cursor-mode nil)
'(c-default-style
(quote
((c-mode . "")
(c++-mode . "")
(objc-mode . "")
(java-mode . "java")
(awk-mode . "awk")
(other . "gnu"))))
'(compilation-message-face (quote default))
'(custom-enabled-themes (quote (spolsky)))
'(custom-safe-themes
(quote
("96998f6f11ef9f551b427b8853d947a7857ea5a578c75aa9c4e7c73fe04d10b4" "0c29db826418061b40564e3351194a3d4a125d182c6ee5178c237a7364f0ff12" "987b709680284a5858d5fe7e4e428463a20dfabe0a6f2a6146b3b8c7c529f08b" "46fd293ff6e2f6b74a5edf1063c32f2a758ec24a5f63d13b07a20255c074d399" "3cd28471e80be3bd2657ca3f03fbb2884ab669662271794360866ab60b6cb6e6" "3cc2385c39257fed66238921602d8104d8fd6266ad88a006d0a4325336f5ee02" "e9776d12e4ccb722a2a732c6e80423331bcb93f02e089ba2a4b02e85de1cf00e" "72a81c54c97b9e5efcc3ea214382615649ebb539cb4f2fe3a46cd12af72c7607" "58c6711a3b568437bab07a30385d34aacf64156cc5137ea20e799984f4227265" "3d5ef3d7ed58c9ad321f05360ad8a6b24585b9c49abcee67bdcbb0fe583a6950" "b3775ba758e7d31f3bb849e7c9e48ff60929a792961a2d536edec8f68c671ca5" "7bde52fdac7ac54d00f3d4c559f2f7aa899311655e7eb20ec5491f3b5c533fe8" "26614652a4b3515b4bbbb9828d71e206cc249b67c9142c06239ed3418eff95e2" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "05c3bc4eb1219953a4f182e10de1f7466d28987f48d647c01f1f0037ff35ab9a" default)))
'(magit-diff-use-overlays nil)
'(menu-bar-mode nil)
'(package-archives
(quote
(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.org/packages/"))))
'(package-selected-packages
(quote
(haskell-mode haskell-snippets sublime-themes ecb yasnippet auto-complete-c-headers smart-mode-line-powerline-theme auto-complete flycheck monokai-theme smart-mode-line)))
'(scroll-bar-mode nil)
'(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.
'(default ((t (:inherit nil :stipple nil :background "#272822" :foreground "#F8F8F2" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 110 :width normal :foundry "outline" :family "Consolas")))))
;; disable beep
(setq visible-bell 1)
;; auto-complete
(require 'auto-complete)
(global-auto-complete-mode t)
(require 'auto-complete-config)
(global-auto-complete-mode t)
;; setup c/c++ headers auto-complete
(defun my:ac-c-headers-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers))
(add-hook 'c++-mode-hook 'my:ac-c-headers-init)
(add-hook 'c-mode-hook 'my:ac-c-headers-init)
;; configuring yasnoppet
(add-to-list 'load-path
"~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)
;; activate ecb
;(require 'ecb)
;(require 'ecb-autoloads)
;; tweak the viewports
;;(split-window-vertically)
(split-window-horizontally)
;; prepare smart mode line
(setq sml/theme 'powerline)
(sml/setup)
;; enable ido-mode
(ido-mode t)
;; maximize emacs on start-up
(defun maximize-frame ()
"Maximizes the active frame in Windows"
(interactive)
;; Send a `WM_SYSCOMMAND' message to the active frame with the
;; `SC_MAXIMIZE' parameter.
(when (eq system-type 'windows-nt)
(w32-send-sys-command 61488)))
(add-hook 'window-setup-hook 'maximize-frame t)
;; customizing indentation mechanism for c, c++, objc and java (not my favorite)
;(defun my-c-mode-common-hook ()
;; my customizations for all of c-mode, c++-mode, objc-mode, java-mode
;(c-set-offset 'substatement-open 0)
;; other customizations can go here
;(setq c++-tab-always-indent t)
;(setq c-basic-offset 4) ;; Default is 2
;(setq c-indent-level 4) ;; Default is 2
;(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60))
;(setq tab-width 4)
;(setq indent-tabs-mode t) ; use spaces only if nil
;)
;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
(defun fix-c-indent-offset-according-to-syntax-context (key val)
;; remove the old element
(setq c-offsets-alist (delq (assoc key c-offsets-alist) c-offsets-alist))
;; new value
(add-to-list 'c-offsets-alist '(key . val)))
(add-hook 'c-mode-common-hook
(lambda ()
(when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
;; indent
(fix-c-indent-offset-according-to-syntax-context 'substatement-open 0))
))
(c-add-style "microsoft"
'("stroustrup"
(c-offsets-alist
(innamespace . -)
(inline-open . 0)
(inher-cont . c-lineup-multi-inher)
(arglist-cont-nonempty . +)
(template-args-cont . +))))
(setq c-default-style "microsoft")
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)