-
Notifications
You must be signed in to change notification settings - Fork 0
/
MrN
168 lines (138 loc) · 5.38 KB
/
MrN
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
; -*- emacs-lisp -*-
;; My own options :-)
; Custom
(when (file-exists-p "~/.emacs.d/custom.el")
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file))
; Start the server for emacsclient
(server-start)
; Clipboard
(setq x-select-enable-clipboard t)
; Indentation
(setq-default indent-tabs-mode nil)
(setq-default tabs-width 2)
; Buffers menu
(setq-default buffers-menu-max-size 30)
; Font lock
(global-font-lock-mode 1)
; Line / Column numbers
(line-number-mode 1)
(column-number-mode 1)
; Size indication
(size-indication-mode 1)
; Add paths
(add-to-list 'load-path "/usr/local/share/emacs")
(add-to-list 'load-path "~/.emacs.d/site-lisp/")
(add-to-list 'load-path "~/local/share/emacs/site-lisp/")
(add-to-list 'load-path "~/dotemacs")
(add-to-list 'load-path "~/dotemacs/haskell-mode-exts/")
(add-to-list 'load-path "~/dotemacs/smex")
; Modeline
(when (require 'modeline-posn nil 'noerror)
(setq-default modelinepos-column-limit 80))
; ido
(require 'ido)
(ido-mode t)
; TRAMP (some of it from http://tsdh.wordpress.com/2008/08/20/re-open-read-only-files-as-root-automagically/)
(require 'tramp) ; total requirement :-)
(defun th-rename-tramp-buffer ()
(when (file-remote-p (buffer-file-name))
(rename-buffer
(format "%s:%s"
(file-remote-p (buffer-file-name) 'method)
(buffer-name)))))
(add-hook 'find-file-hook
'th-rename-tramp-buffer)
(defadvice find-file (around th-find-file activate)
"Open FILENAME using tramp's sudo method if it's read-only."
(if (and (not (file-writable-p (ad-get-arg 0)))
(y-or-n-p (concat "File "
(ad-get-arg 0)
" is read-only. Open it as root? ")))
(th-find-file-sudo (ad-get-arg 0))
ad-do-it))
(defun th-find-file-sudo (file)
"Opens FILE with root privileges."
(interactive "F")
(set-buffer (find-file (concat "/sudo::" file))))
; C++ Mode
(defun aristid-c-mode-common ()
(interactive)
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\|TODO\\|XXX+\\|BUG\\):"
1 font-lock-warning-face prepend)))
(c-set-style "user")
(setq c-basic-offset 2)
(c-set-offset 'arglist-intro '++)
(c-set-offset 'arglist-close 0)
(c-set-offset 'label 0))
(add-hook 'c-mode-common-hook 'aristid-c-mode-common)
; Org
(when (require 'org-install nil 'noerror)
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)))
; ESS
(require 'ess-site "ess/ess-site" 'noerror)
; Maxima
(add-to-list 'load-path "/usr/share/emacs23/site-lisp/maxima")
(autoload 'maxima-mode "maxima/maxima" "Maxima mode" t)
(autoload 'imaxima "maxima/imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima/maxima" "Maxima interaction" t)
(autoload 'imath-mode "maxima/imath" "Imath mode for math formula input" t)
(setq imaxima-use-maxima-mode-flag t)
; Textile
(when (require 'textile-mode nil 'noerror)
(add-to-list 'auto-mode-alist '("\\.textile\\'" . textile-mode)))
; Ledger
(when (require 'ledger nil 'noerror)
(add-to-list 'auto-mode-alist '("\\.ledger\\'" . ledger-mode)))
; SMEX (= ido for M-x)
(when (require 'smex nil 'noerror)
(add-hook 'after-init-hook 'smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
(global-set-key (kbd "C-c M-x") 'smex-update-and-run)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
(smex-initialize) ; only needed when you load this file with M-x eval-buffer
)
; Haskell
(load "~/dotemacs/haskell-mode-2.8.0/haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
(when (require 'haskell-align-imports nil 'noerror)
;(define-key haskell-mode-map (kbd "C-c .") 'haskell-align-imports)
)
; Auto complete
(add-to-list 'load-path "~/.emacs.d/")
(when (require 'auto-complete-config nil 'noerror)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)
(require 'auto-complete-extensioni nil 'noerror)
(global-auto-complete-mode t) ;enable global-mode
(setq ac-auto-start 4) ;automatically start
(setq ac-dwim t) ;Do what i mean
(ac-set-trigger-key "TAB")
(setq ac-modes
'(emacs-lisp-mode lisp-interaction-mode lisp-mode scheme-mode
c-mode cc-mode c++-mode java-mode
perl-mode cperl-mode python-mode ruby-mode
ecmascript-mode javascript-mode php-mode css-mode
makefile-mode sh-mode fortran-mode f90-mode ada-mode
xml-mode sgml-mode
haskell-mode literate-haskell-mode
emms-tag-editor-mode
asm-mode
org-mode))
(dolist (hook (list
'emacs-lisp-mode-hook
'lisp-interaction-mode
))
(add-hook hook '(lambda ()
(add-to-list 'ac-sources 'ac-source-symbols))))
(add-hook 'c++-mode-hook '(lambda ()
(add-to-list 'ac-sources 'ac-c++-sources)))
(add-hook 'haskell-mode-hook '(lambda ()
(add-to-list 'ac-sources 'ac-source-haskell)))
)