commit | author | age
|
d070a7
|
1 |
#+TITLE: My Emacs configuration |
C |
2 |
* Windows dependencies |
|
3 |
Dependencies needed for Aspell, poppler PDF-tools, compilers and ghost-script provided by mingw64 |
|
4 |
#+BEGIN_SRC emacs-lisp |
|
5 |
(when (eq system-type 'windows-nt) |
db15ba
|
6 |
;; (add-to-list 'exec-path "C:/msys64/usr/bin") |
d070a7
|
7 |
(add-to-list 'exec-path "C:/msys64/mingw64/bin") |
6a3ca9
|
8 |
(add-to-list 'exec-path "c:/Program Files/gnuplot") |
d070a7
|
9 |
(setenv "PATH" (mapconcat #'identity exec-path path-separator))) |
C |
10 |
#+END_SRC |
|
11 |
|
|
12 |
* Aesthetic changes |
|
13 |
** Zenburn theme |
|
14 |
#+BEGIN_SRC emacs-lisp |
|
15 |
(use-package zenburn-theme |
|
16 |
:ensure t |
|
17 |
:config |
|
18 |
(load-theme 'zenburn t)) |
|
19 |
#+END_SRC |
|
20 |
** Default font |
|
21 |
#+BEGIN_SRC emacs-lisp |
|
22 |
(set-default-font "DejaVu Sans Mono-10") |
|
23 |
#+END_SRC |
|
24 |
* Writing requirements |
|
25 |
** Spellchecking |
|
26 |
#+BEGIN_SRC emacs-lisp |
|
27 |
(require 'ispell) |
|
28 |
(setq-default ispell-program-name "aspell") |
|
29 |
(add-hook 'latex-mode-hook 'flyspell-mode) |
|
30 |
(add-hook 'latex-mode-hook 'flyspell-buffer) |
|
31 |
(add-hook 'org-mode-hook 'flyspell-mode) |
|
32 |
(add-hook 'org-mode-hook 'flyspell-buffer) |
|
33 |
#+END_SRC |
|
34 |
|
|
35 |
** Switch-window |
|
36 |
Helps to change windows easily when many are open at once |
|
37 |
#+BEGIN_SRC emacs-lisp |
|
38 |
(use-package switch-window |
|
39 |
:ensure t |
|
40 |
:config |
|
41 |
(setq switch-window-input-style 'minibuffer) |
|
42 |
(setq switch-window-increase 4) |
|
43 |
(setq switch-window-threshold 2) |
|
44 |
(setq switch-window-shortcut-style 'qwerty) |
|
45 |
(setq switch-window-qwerty-shortcuts |
|
46 |
'("a" "s" "d" "f" "j" "k" "l" "i" "o")) |
|
47 |
:bind |
|
48 |
([remap other-window] . switch-window)) |
|
49 |
#+END_SRC |
|
50 |
** Go to new window when opened |
|
51 |
#+BEGIN_SRC emacs-lisp |
|
52 |
(defun split-and-follow-horizontally () |
|
53 |
(interactive) |
|
54 |
(split-window-below) |
|
55 |
(balance-windows) |
|
56 |
(other-window 1)) |
|
57 |
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally) |
|
58 |
|
|
59 |
(defun split-and-follow-vertically () |
|
60 |
(interactive) |
|
61 |
(split-window-right) |
|
62 |
(balance-windows) |
|
63 |
(other-window 1)) |
|
64 |
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically) |
|
65 |
#+END_SRC |
|
66 |
** PDF-tools |
|
67 |
#+BEGIN_SRC emacs-lisp |
|
68 |
(use-package pdf-tools |
|
69 |
:ensure t |
|
70 |
:config |
|
71 |
(pdf-tools-install)) |
|
72 |
|
|
73 |
#+END_SRC |
b1d01d
|
74 |
* Helm and Projectile |
d070a7
|
75 |
** Helm core |
C |
76 |
#+BEGIN_SRC emacs-lisp |
|
77 |
(use-package helm-config |
|
78 |
:ensure helm |
|
79 |
:bind (("M-x" . helm-M-x) |
|
80 |
("C-x C-f" . helm-find-files) |
|
81 |
("M-y" . helm-show-kill-ring) |
|
82 |
("C-x b" . helm-mini) |
|
83 |
("C-c h o" . helm-occur)) |
|
84 |
:config |
|
85 |
(setq helm-M-x-fuzzy-match t) |
|
86 |
(setq helm-buffers-fuzzy-matching t |
|
87 |
helm-recentf-fuzzy-match t) |
|
88 |
(setq helm-split-window-in-side-p t ; open helm buffer inside current window, not occupy whole other window |
|
89 |
helm-move-to-line-cycle-in-source t ; move to end or beginning of source when reaching top or bottom of source. |
|
90 |
helm-ff-search-library-in-sexp t ; search for library in `require' and `declare-function' sexp. |
|
91 |
helm-scroll-amount 8 ; scroll 8 lines other window using M-<next>/M-<prior> |
|
92 |
helm-ff-file-name-history-use-recentf t |
|
93 |
helm-echo-input-in-header-line t) |
|
94 |
(defun spacemacs//helm-hide-minibuffer-maybe () |
|
95 |
"Hide minibuffer in Helm session if we use the header line as input field." |
|
96 |
(when (with-helm-buffer helm-echo-input-in-header-line) |
|
97 |
(let ((ov (make-overlay (point-min) (point-max) nil nil t))) |
|
98 |
(overlay-put ov 'window (selected-window)) |
|
99 |
(overlay-put ov 'face |
|
100 |
(let ((bg-color (face-background 'default nil))) |
|
101 |
`(:background ,bg-color :foreground ,bg-color))) |
|
102 |
(setq-local cursor-type nil)))) |
|
103 |
(add-hook 'helm-minibuffer-set-up-hook |
|
104 |
'spacemacs//helm-hide-minibuffer-maybe) |
|
105 |
(helm-mode 1)) |
|
106 |
#+END_SRC |
|
107 |
** Projectile |
|
108 |
*** Enable it |
|
109 |
#+BEGIN_SRC emacs-lisp |
|
110 |
(use-package projectile |
|
111 |
:ensure t |
|
112 |
:bind ("C-c p" . projectile-command-map) |
1650a5
|
113 |
:diminish projectile-mode |
d070a7
|
114 |
:config |
C |
115 |
(projectile-global-mode) |
|
116 |
(setq projectile-completion-system 'helm) |
b1d01d
|
117 |
(when (eq system-type 'windows-nt) |
C |
118 |
(setq projectile-indexing-method 'alien))) |
d070a7
|
119 |
#+END_SRC |
C |
120 |
*** Let it compile things |
|
121 |
#+BEGIN_SRC emacs-lisp |
|
122 |
(global-set-key (kbd "<f5>") 'projectile-compile-project) |
|
123 |
#+END_SRC |
|
124 |
*** Enable communication with helm |
|
125 |
#+BEGIN_SRC emacs-lisp |
|
126 |
(use-package helm-projectile |
|
127 |
:ensure t |
|
128 |
:config |
|
129 |
(helm-projectile-on)) |
|
130 |
#+END_SRC |
|
131 |
* Small tweaks |
|
132 |
** Remove startup screen |
|
133 |
#+BEGIN_SRC emacs-lisp |
|
134 |
(setq inhibit-startup-message t) |
|
135 |
#+END_SRC |
|
136 |
** Disable bell |
|
137 |
Bloody bell dings every time you hit a key too much |
|
138 |
#+BEGIN_SRC emacs-lisp |
|
139 |
(setq ring-bell-function 'ignore) |
|
140 |
#+END_SRC |
|
141 |
** Pretty symbols |
|
142 |
Why not? They make it look nice |
|
143 |
#+BEGIN_SRC emacs-lisp |
|
144 |
(when window-system |
|
145 |
(use-package pretty-mode |
|
146 |
:ensure t |
|
147 |
:diminish t |
|
148 |
:config |
|
149 |
(global-pretty-mode))) |
|
150 |
#+END_SRC |
|
151 |
** find file other window |
|
152 |
Lets it accept more than one file. Works recursively. |
|
153 |
#+BEGIN_SRC emacs-lisp |
|
154 |
(defadvice find-file-other-window (around find-files activate) |
|
155 |
(if (listp filename) |
|
156 |
(loop for f in filename do (find-file-other-window f wildcards)) |
|
157 |
ad-do-it)) |
|
158 |
#+END_SRC |
|
159 |
** Which key |
|
160 |
Helps to explain keybindings if you get lost |
|
161 |
#+BEGIN_SRC emacs-lisp |
|
162 |
(use-package which-key |
|
163 |
:ensure t |
|
164 |
:diminish which-key-mode |
|
165 |
:config |
|
166 |
(which-key-mode)) |
|
167 |
#+END_SRC |
|
168 |
** Go to this file |
|
169 |
#+BEGIN_SRC emacs-lisp |
|
170 |
(defun config-visit () |
|
171 |
(interactive) |
|
172 |
(find-file "~/.emacs.d/config.org")) |
|
173 |
(global-set-key (kbd "C-c e d") 'config-visit) |
|
174 |
#+END_SRC |
1650a5
|
175 |
** Go to init.el |
C |
176 |
#+BEGIN_SRC emacs-lisp |
|
177 |
(defun init-visit () |
|
178 |
(interactive) |
|
179 |
(find-file "~/.emacs.d/init.el")) |
|
180 |
(global-set-key (kbd "C-c e i") 'init-visit) |
|
181 |
#+END_SRC |
d070a7
|
182 |
** Reload configuration |
C |
183 |
#+BEGIN_SRC emacs-lisp |
|
184 |
(defun config-reload () |
|
185 |
"Reloads ~/.emacs.d/config.org at run time" |
|
186 |
(interactive) |
|
187 |
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) |
|
188 |
(global-set-key (kbd "C-c e r") 'config-reload) |
|
189 |
#+END_SRC |
|
190 |
** Smartparens |
|
191 |
Matches brackets automatically |
|
192 |
#+BEGIN_SRC emacs-lisp |
|
193 |
(use-package smartparens |
|
194 |
:ensure t |
|
195 |
:diminish smartparens-mode |
|
196 |
:config |
|
197 |
(progn |
|
198 |
(require 'smartparens-config) |
|
199 |
(smartparens-global-mode 1))) |
|
200 |
#+END_SRC |
|
201 |
** Rainbow |
|
202 |
Its a little gimmicky but its still cool |
|
203 |
#+BEGIN_SRC emacs-lisp |
|
204 |
(use-package rainbow-mode |
|
205 |
:ensure t |
1650a5
|
206 |
:diminish rainbow-mode |
d070a7
|
207 |
:init |
C |
208 |
(add-hook 'prog-mode-hook 'rainbow-mode)) |
|
209 |
#+END_SRC |
|
210 |
** Rainbow delimiters |
|
211 |
A bit more useful than above. |
|
212 |
Colours the brackets so that they stand out more. |
|
213 |
#+BEGIN_SRC emacs-lisp |
|
214 |
(use-package rainbow-delimiters |
|
215 |
:ensure t |
|
216 |
:init |
|
217 |
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) |
|
218 |
#+END_SRC |
|
219 |
** clean-aindent-mode |
|
220 |
Removes unnecessary white space |
|
221 |
#+BEGIN_SRC emacs-lisp |
|
222 |
(use-package clean-aindent-mode |
|
223 |
:ensure t |
|
224 |
:hook prog-mode) |
|
225 |
#+END_SRC |
|
226 |
Shows trailing white space |
|
227 |
#+BEGIN_SRC emacs-lisp |
|
228 |
(add-hook 'prog-mode-hook (lambda () (interactive) (setq show-trailing-whitespace 1))) |
|
229 |
#+END_SRC |
|
230 |
** whitespace mode |
|
231 |
Reveals whitespace characters |
|
232 |
#+BEGIN_SRC emacs-lisp |
|
233 |
(global-set-key (kbd "C-c w") 'whitespace-mode) |
|
234 |
(add-hook 'diff-mode-hook (lambda () |
|
235 |
(setq-local whitespace-style |
|
236 |
'(face |
|
237 |
tabs |
|
238 |
tab-mark |
|
239 |
spaces |
|
240 |
space-mark |
|
241 |
trailing |
|
242 |
indentation::space |
|
243 |
indentation::tab |
|
244 |
newline |
|
245 |
newline-mark)) |
|
246 |
(whitespace-mode 1))) |
|
247 |
|
|
248 |
#+END_SRC |
|
249 |
** eldoc |
|
250 |
#+BEGIN_SRC emacs-lisp |
|
251 |
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode) |
|
252 |
(add-hook 'lisp-interaction-mode-hook 'eldoc-mode) |
|
253 |
(add-hook 'ielm-mode-hook 'eldoc-mode) |
|
254 |
#+END_SRC |
|
255 |
** key-freq |
|
256 |
collects interesting statistics |
|
257 |
#+BEGIN_SRC emacs-lisp |
|
258 |
(use-package keyfreq |
|
259 |
:ensure t |
|
260 |
:config |
|
261 |
(keyfreq-mode 1) |
|
262 |
(keyfreq-autosave-mode 1)) |
|
263 |
#+END_SRC |
|
264 |
** undo-tree |
|
265 |
A more advanced undo mechanism |
|
266 |
#+BEGIN_SRC emacs-lisp |
|
267 |
(use-package undo-tree |
|
268 |
:ensure t |
1650a5
|
269 |
:diminish undo-tree-mode |
d070a7
|
270 |
:config |
C |
271 |
(global-undo-tree-mode)) |
|
272 |
#+END_SRC |
|
273 |
** volatile highlights |
|
274 |
Colour the material just copied |
|
275 |
#+BEGIN_SRC emacs-lisp |
|
276 |
(use-package volatile-highlights |
|
277 |
:ensure t |
1650a5
|
278 |
:diminish volatile-highlights-mode |
d070a7
|
279 |
:config |
C |
280 |
(volatile-highlights-mode t)) |
|
281 |
#+END_SRC |
|
282 |
** Workgroups |
|
283 |
Open the pages when you quit |
|
284 |
#+BEGIN_SRC emacs-lisp |
|
285 |
(use-package workgroups2 |
|
286 |
:ensure t |
1650a5
|
287 |
:diminish workgroups-mode |
d070a7
|
288 |
:config |
C |
289 |
(workgroups-mode 1)) |
|
290 |
#+END_SRC |
|
291 |
** ibuffer |
|
292 |
#+BEGIN_SRC emacs-lisp |
|
293 |
(global-set-key (kbd "C-x C-b") 'ibuffer) |
|
294 |
(setq ibuffer-use-other-window t) |
|
295 |
#+END_SRC |
|
296 |
** hippie expand |
|
297 |
#+BEGIN_SRC emacs-lisp |
|
298 |
(global-set-key (kbd "M-/") 'hippie-expand) ;; replace dabbrev-expand |
|
299 |
(setq |
|
300 |
hippie-expand-try-functions-list |
|
301 |
'(try-expand-dabbrev ;; Try to expand word "dynamically", searching the current buffer. |
|
302 |
try-expand-dabbrev-all-buffers ;; Try to expand word "dynamically", searching all other buffers. |
|
303 |
try-expand-dabbrev-from-kill ;; Try to expand word "dynamically", searching the kill ring. |
|
304 |
try-complete-file-name-partially ;; Try to complete text as a file name, as many characters as unique. |
|
305 |
try-complete-file-name ;; Try to complete text as a file name. |
|
306 |
try-expand-all-abbrevs ;; Try to expand word before point according to all abbrev tables. |
|
307 |
try-expand-list ;; Try to complete the current line to an entire line in the buffer. |
|
308 |
try-expand-line ;; Try to complete the current line to an entire line in the buffer. |
|
309 |
try-complete-lisp-symbol-partially ;; Try to complete as an Emacs Lisp symbol, as many characters as unique. |
|
310 |
try-complete-lisp-symbol) ;; Try to complete word as an Emacs Lisp symbol. |
|
311 |
) |
|
312 |
#+END_SRC |
|
313 |
** Highlight line |
|
314 |
#+BEGIN_SRC emacs-lisp |
|
315 |
(global-hl-line-mode) |
|
316 |
#+END_SRC |
|
317 |
** Line numbers |
|
318 |
#+BEGIN_SRC emacs-lisp |
|
319 |
(add-hook 'prog-mode-hook 'linum-mode) |
|
320 |
#+END_SRC |
|
321 |
|
|
322 |
** Garbage collection |
|
323 |
starts garbage collection every 100MB |
|
324 |
#+BEGIN_SRC emacs-lisp |
|
325 |
(setq gc-cons-threshold 100000000) |
|
326 |
#+END_SRC |
|
327 |
|
|
328 |
** Kill ring |
|
329 |
Changes the kill ring size to 5000. |
|
330 |
#+BEGIN_SRC emacs-lisp |
|
331 |
(setq global-mark-ring-max 5000 |
|
332 |
mark-ring-max 5000 |
|
333 |
mode-require-final-newline t |
|
334 |
kill-ring-max 5000 |
|
335 |
kill-whole-line t) |
|
336 |
#+END_SRC |
|
337 |
** Coding style |
|
338 |
#+BEGIN_SRC emacs-lisp |
|
339 |
(setq c-default-style "linux") |
|
340 |
#+END_SRC |
|
341 |
|
|
342 |
** Coding system |
|
343 |
#+BEGIN_SRC emacs-lisp |
|
344 |
(set-terminal-coding-system 'utf-8) |
|
345 |
(set-keyboard-coding-system 'utf-8) |
|
346 |
(set-language-environment "UTF-8") |
|
347 |
(prefer-coding-system 'utf-8) |
|
348 |
(setq-default indent-tabs-mode t) |
|
349 |
(delete-selection-mode) |
|
350 |
(global-set-key (kbd "RET") 'newline-and-indent) |
|
351 |
#+END_SRC |
|
352 |
** Move to beginning of line ignoring whitespace |
|
353 |
Move point back to indentation of beginning of line. |
|
354 |
|
|
355 |
Move point to the first non-whitespace character on this line. |
|
356 |
If point is already there, move to the beginning of the line. |
|
357 |
Effectively toggle between the first non-whitespace character and |
|
358 |
the beginning of the line. |
|
359 |
|
|
360 |
If ARG is not nil or 1, move forward ARG - 1 lines first. If |
|
361 |
point reaches the beginning or end of the buffer, stop there. |
|
362 |
#+BEGIN_SRC emacs-lisp |
|
363 |
(defun prelude-move-beginning-of-line (arg) |
|
364 |
(interactive "^p") |
|
365 |
(setq arg (or arg 1)) |
|
366 |
|
|
367 |
;; Move lines first |
|
368 |
(when (/= arg 1) |
|
369 |
(let ((line-move-visual nil)) |
|
370 |
(forward-line (1- arg)))) |
|
371 |
|
|
372 |
(let ((orig-point (point))) |
|
373 |
(back-to-indentation) |
|
374 |
(when (= orig-point (point)) |
|
375 |
(move-beginning-of-line 1)))) |
|
376 |
|
|
377 |
(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line) |
|
378 |
#+END_SRC |
|
379 |
** Indent region or buffer |
|
380 |
#+BEGIN_SRC emacs-lisp |
|
381 |
(defun indent-region-or-buffer () |
|
382 |
"Indent a region if selected, otherwise the whole buffer." |
|
383 |
(interactive) |
|
384 |
(unless (member major-mode prelude-indent-sensitive-modes) |
|
385 |
(save-excursion |
|
386 |
(if (region-active-p) |
|
387 |
(progn |
|
388 |
(indent-region (region-beginning) (region-end)) |
|
389 |
(message "Indented selected region.")) |
|
390 |
(progn |
|
391 |
(indent-buffer) |
|
392 |
(message "Indented buffer."))) |
|
393 |
(whitespace-cleanup)))) |
|
394 |
|
|
395 |
(global-set-key (kbd "C-c i") 'indent-region-or-buffer) |
|
396 |
#+END_SRC |
|
397 |
** Tramp |
|
398 |
#+BEGIN_SRC emacs-lisp |
|
399 |
(when (eq system-type 'windows-nt) |
0b811a
|
400 |
(setq tramp-default-method "pscp")) |
d070a7
|
401 |
(setq password-cache-expiry nil) |
C |
402 |
#+END_SRC |
|
403 |
|
|
404 |
* Mode line tweaks |
|
405 |
Diminish is used but is included in init.el such that it can be used throughout this document |
|
406 |
** Spaceline |
|
407 |
A little easier to read than the default emacs mode line |
|
408 |
#+BEGIN_SRC emacs-lisp |
|
409 |
(use-package spaceline |
|
410 |
:ensure t |
|
411 |
:config |
|
412 |
(require 'spaceline-config) |
|
413 |
(setq spaceline-buffer-encoding-abbrev-p t) |
|
414 |
(setq spaceline-line-column-p t) |
|
415 |
(setq spaceline-line-p t) |
|
416 |
(setq powerline-default-separator (quote arrow)) |
|
417 |
(spaceline-spacemacs-theme)) |
|
418 |
#+END_SRC |
|
419 |
** No separator |
|
420 |
#+BEGIN_SRC emacs-lisp |
|
421 |
(setq powerline-default-seperator nil) |
|
422 |
#+END_SRC |
|
423 |
* Programming tweaks |
|
424 |
** Yasnippet |
|
425 |
#+BEGIN_SRC emacs-lisp |
1650a5
|
426 |
(use-package yasnippet |
C |
427 |
:ensure t |
|
428 |
:diminish yas-minor-mode |
|
429 |
:config |
|
430 |
(use-package yasnippet-snippets |
|
431 |
:ensure t) |
|
432 |
(yas-reload-all) |
|
433 |
(yas-global-mode 1)) |
d070a7
|
434 |
#+END_SRC |
C |
435 |
** flycheck |
|
436 |
#+BEGIN_SRC emacs-lisp |
|
437 |
(use-package flycheck |
|
438 |
:ensure t) |
|
439 |
#+END_SRC |
|
440 |
*** flycheck-pos-tip |
|
441 |
#+BEGIN_SRC emacs-lisp |
|
442 |
(use-package flycheck-pos-tip |
|
443 |
:ensure t |
|
444 |
:after flycheck |
|
445 |
:config |
|
446 |
(flycheck-pos-tip-mode)) |
|
447 |
#+END_SRC |
|
448 |
** Company |
|
449 |
Company is auto-complete for emacs |
|
450 |
#+BEGIN_SRC emacs-lisp |
|
451 |
(use-package company |
|
452 |
:ensure t |
1650a5
|
453 |
:diminish company-mode |
d070a7
|
454 |
:config |
b1d01d
|
455 |
(global-company-mode) |
d070a7
|
456 |
(setq company-idle-delay 0) |
C |
457 |
(setq company-minimum-prefix-length 3)) |
|
458 |
#+END_SRC |
|
459 |
** Magit |
|
460 |
#+BEGIN_SRC emacs-lisp |
b5e027
|
461 |
(use-package magit |
C |
462 |
:ensure t |
|
463 |
:commands magit-get-top-dir |
|
464 |
:bind ("C-x g" . magit-status) |
|
465 |
:init |
|
466 |
(progn |
|
467 |
;; make magit status go full-screen but remember previous window |
|
468 |
;; settings |
|
469 |
;; from: http://whattheemacsd.com/setup-magit.el-01.html |
|
470 |
(defadvice magit-status (around magit-fullscreen activate) |
|
471 |
(window-configuration-to-register :magit-fullscreen) |
d070a7
|
472 |
ad-do-it |
b5e027
|
473 |
(delete-other-windows)) |
d070a7
|
474 |
|
b5e027
|
475 |
;; Close popup when committing - this stops the commit window |
C |
476 |
;; hanging around |
|
477 |
;; From: http://git.io/rPBE0Q |
|
478 |
(defadvice git-commit-commit (after delete-window activate) |
|
479 |
(delete-window)) |
|
480 |
|
|
481 |
(defadvice git-commit-abort (after delete-window activate) |
|
482 |
(delete-window)) |
|
483 |
|
|
484 |
:config |
|
485 |
(progn |
|
486 |
;; restore previously hidden windows |
|
487 |
(defadvice magit-quit-window (around magit-restore-screen activate) |
|
488 |
(let ((current-mode major-mode)) |
|
489 |
ad-do-it |
|
490 |
;; we only want to jump to register when the last seen buffer |
|
491 |
;; was a magit-status buffer. |
|
492 |
(when (eq 'magit-status-mode current-mode) |
|
493 |
(jump-to-register :magit-fullscreen))))) |
|
494 |
|
|
495 |
;; magit settings |
|
496 |
(setq |
|
497 |
;; don't put "origin-" in front of new branch names by default |
|
498 |
magit-default-tracking-name-function 'magit-default-tracking-name-branch-only |
|
499 |
;; open magit status in same window as current buffer |
|
500 |
magit-status-buffer-switch-function 'switch-to-buffer |
|
501 |
;; highlight word/letter changes in hunk diffs |
|
502 |
magit-diff-refine-hunk t |
|
503 |
;; ask me if I want to include a revision when rewriting |
|
504 |
magit-rewrite-inclusive 'ask |
|
505 |
;; ask me to save buffers |
|
506 |
magit-save-some-buffers t |
|
507 |
;; pop the process buffer if we're taking a while to complete |
|
508 |
magit-process-popup-time 10 |
|
509 |
;; ask me if I want a tracking upstream |
|
510 |
magit-set-upstream-on-push 'askifnotset |
|
511 |
))) |
d070a7
|
512 |
#+END_SRC |
C |
513 |
** CEDET |
|
514 |
*** semantic |
|
515 |
#+BEGIN_SRC emacs-lisp |
|
516 |
(use-package semantic |
|
517 |
:config |
|
518 |
(global-semanticdb-minor-mode 1) |
|
519 |
(global-semantic-idle-scheduler-mode 1) |
|
520 |
(global-semantic-idle-summary-mode 1) |
|
521 |
(semantic-mode 1)) |
|
522 |
#+END_SRC |
|
523 |
*** EDE |
|
524 |
#+BEGIN_SRC emacs-lisp |
|
525 |
(use-package ede |
|
526 |
:config |
|
527 |
(global-ede-mode t)) |
|
528 |
#+END_SRC |
|
529 |
*** gdb-many-windows |
|
530 |
#+BEGIN_SRC emacs-lisp |
|
531 |
(setq |
|
532 |
;; use gdb-many-windows by default |
|
533 |
gdb-many-windows t |
|
534 |
|
|
535 |
;; Non-nil means display source file containing the main routine at startup |
|
536 |
gdb-show-main t) |
|
537 |
#+END_SRC |
|
538 |
*** Semantic refactor |
|
539 |
#+BEGIN_SRC emacs-lisp |
|
540 |
(use-package srefactor |
|
541 |
:ensure t |
|
542 |
:bind (("M-RET o" . 'srefactor-lisp-one-line) |
|
543 |
("M-RET m" . 'srefactor-lisp-format-sexp) |
|
544 |
("M-RET d" . 'srefactor-lisp-format-defun) |
|
545 |
("M-RET b" . 'srefactor-lisp-format-buffer) |
|
546 |
:map c-mode-base-map |
|
547 |
("M-RET" . 'srefactor-refactor-at-point) |
|
548 |
:map c++-mode-map |
|
549 |
("M-RET" . 'srefactor-refactor-at-point))) |
|
550 |
#+END_SRC |
1650a5
|
551 |
** Language specific configs |
C |
552 |
*** C/C++ |
|
553 |
**** yasnippet |
|
554 |
#+BEGIN_SRC emacs-lisp |
|
555 |
(add-hook 'c++-mode-hook 'yas-minor-mode) |
|
556 |
(add-hook 'c-mode-hook 'yas-minor-mode) |
|
557 |
#+END_SRC |
|
558 |
**** flycheck clang |
|
559 |
#+BEGIN_SRC emacs-lisp |
|
560 |
(use-package flycheck-clang-analyzer |
|
561 |
:ensure t |
|
562 |
:config |
|
563 |
(with-eval-after-load 'flycheck |
|
564 |
(require 'flycheck-clang-analyzer) |
|
565 |
(flycheck-clang-analyzer-setup))) |
|
566 |
#+END_SRC |
|
567 |
**** company |
|
568 |
#+BEGIN_SRC emacs-lisp |
|
569 |
(use-package company-c-headers |
b1d01d
|
570 |
:ensure tk |
db15ba
|
571 |
:after company |
C |
572 |
:config |
|
573 |
(add-hook 'c++-mode-hook 'company-mode) |
|
574 |
(add-hook 'c-mode-hook 'company-mode)) |
1650a5
|
575 |
|
C |
576 |
(use-package company-irony |
|
577 |
:ensure t |
|
578 |
:config |
|
579 |
(add-to-list 'company-backends '(company-c-headers |
db15ba
|
580 |
company-dabbrev-code |
C |
581 |
company-irony))) |
1650a5
|
582 |
|
C |
583 |
(use-package irony |
|
584 |
:ensure t |
|
585 |
:config |
db15ba
|
586 |
(setq w32-pipe-read-delay 0) |
1650a5
|
587 |
(add-hook 'c++-mode-hook 'irony-mode) |
C |
588 |
(add-hook 'c-mode-hook 'irony-mode) |
|
589 |
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)) |
|
590 |
#+END_SRC |
|
591 |
*** emacs-lisp |
|
592 |
**** eldoc |
|
593 |
#+BEGIN_SRC emacs-lisp |
|
594 |
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode) |
|
595 |
#+END_SRC |
|
596 |
**** yasnippet |
|
597 |
#+BEGIN_SRC emacs-lisp |
|
598 |
(add-hook 'emacs-lisp-mode-hook 'yas-minor-mode) |
|
599 |
#+END_SRC |
|
600 |
**** company |
|
601 |
#+BEGIN_SRC emacs-lisp |
|
602 |
(add-hook 'emacs-lisp-mode-hook 'company-mode) |
|
603 |
|
|
604 |
(use-package slime |
|
605 |
:ensure t |
|
606 |
:config |
|
607 |
(setq inferior-lisp-program "/usr/bin/sbcl") |
|
608 |
(setq slime-contribs '(slime-fancy))) |
|
609 |
|
|
610 |
(use-package slime-company |
|
611 |
:ensure t |
|
612 |
:init |
|
613 |
(require 'company) |
|
614 |
(slime-setup '(slime-fancy slime-company))) |
|
615 |
#+END_SRC |
|
616 |
*** x86 |
|
617 |
**** x86-lookup |
|
618 |
#+BEGIN_SRC emacs-lisp |
|
619 |
(use-package x86-lookup |
|
620 |
:ensure t |
|
621 |
:init |
|
622 |
(setq x86-lookup-pdf "D:/Coding/x86-instructions.pdf") |
|
623 |
:bind ("C-h x" . x86-lookup)) |
|
624 |
#+END_SRC |
|
625 |
*** Latex |
|
626 |
**** AucTex |
|
627 |
#+BEGIN_SRC emacs-lisp |
|
628 |
(use-package tex |
|
629 |
:ensure auctex |
|
630 |
:config |
|
631 |
(setq TeX-auto-save t) |
|
632 |
(setq TeX-parse-self t) |
|
633 |
(setq doc-view-ghostscript-program "c:/msys64/mingw64/bin/gswin32c.exe") |
|
634 |
(setq preview-gs-command "c:/msys64/mingw64/bin/gs.exe")) |
|
635 |
#+END_SRC |
|
636 |
**** Company |
|
637 |
#+BEGIN_SRC emacs-lisp |
|
638 |
(use-package company-math |
|
639 |
:ensure t |
|
640 |
:after company |
|
641 |
:config |
|
642 |
(add-to-list 'company-backends 'company-math-symbols-unicode)) |
b1d01d
|
643 |
|
C |
644 |
(use-package company-reftex |
|
645 |
:ensure t |
|
646 |
:after company |
|
647 |
:config |
|
648 |
(add-to-list 'company-backends 'company-reftex)) |
|
649 |
|
|
650 |
(use-package company-auctex |
|
651 |
:ensure t |
|
652 |
:after company |
|
653 |
:config |
|
654 |
(company-auctex-init)) |
b5e027
|
655 |
|
C |
656 |
(use-package company-bibtex |
|
657 |
:ensure t |
|
658 |
:after company |
|
659 |
(add-to-list 'company-backends 'company-bibtex)) |
1650a5
|
660 |
#+END_SRC |
C |
661 |
**** Preview pane |
|
662 |
#+BEGIN_SRC emacs-lisp |
|
663 |
(use-package latex-preview-pane |
|
664 |
:ensure t |
|
665 |
:config |
|
666 |
(latex-preview-pane-enable)) |
|
667 |
#+END_SRC |
6a3ca9
|
668 |
**** TeXcount |
C |
669 |
Word counts in latex |
|
670 |
#+BEGIN_SRC emacs-lisp |
b5e027
|
671 |
(when (eq system-type 'windows-nt) |
C |
672 |
(add-to-list 'exec-path "c:/Users/joelg/TeXcount_3_1_1") |
|
673 |
(setenv "PATH" (mapconcat #'identity exec-path path-separator))) |
|
674 |
|
6a3ca9
|
675 |
(defun texcount () |
b5e027
|
676 |
(interactive) |
C |
677 |
(let* |
|
678 |
( (this-file (buffer-file-name)) |
|
679 |
(enc-str (symbol-name buffer-file-coding-system)) |
|
680 |
(enc-opt |
|
681 |
(cond |
|
682 |
((string-match "utf-8" enc-str) "-utf8") |
|
683 |
((string-match "latin" enc-str) "-latin1") |
|
684 |
("-encoding=guess") |
|
685 |
) ) |
|
686 |
(word-count |
|
687 |
(with-output-to-string |
|
688 |
(with-current-buffer standard-output |
|
689 |
(call-process "texcount" nil t nil "-0" enc-opt this-file) |
|
690 |
) ) ) ) |
|
691 |
(message word-count) |
|
692 |
) ) |
6a3ca9
|
693 |
(add-hook 'LaTeX-mode-hook (lambda () (define-key LaTeX-mode-map (kbd "C-c c") 'texcount))) |
C |
694 |
(add-hook 'latex-mode-hook (lambda () (define-key latex-mode-map (kbd "C-c c") 'texcount))) |
|
695 |
#+END_SRC |
|
696 |
|
1650a5
|
697 |
*** PlantUML |
C |
698 |
#+BEGIN_SRC emacs-lisp |
|
699 |
(use-package plantuml-mode |
|
700 |
:ensure t |
|
701 |
:init |
|
702 |
(setq plantuml-jar-path "c:/ProgramData/chocolatey/lib/plantuml/tools/plantuml.jar")) |
|
703 |
#+END_SRC |
b5e027
|
704 |
|
C |
705 |
*** Matlab |
|
706 |
**** Matlab mode |
|
707 |
#+BEGIN_SRC emacs-lisp |
|
708 |
(use-package matlab-mode |
|
709 |
:ensure t |
|
710 |
:config |
|
711 |
(autoload 'matlab-mode "matlab" "Matlab Editing Mode" t) |
|
712 |
(add-to-list |
|
713 |
'auto-mode-alist |
|
714 |
'("\\.m$" . matlab-mode)) |
|
715 |
(setq matlab-indent-function t)) |
|
716 |
#+END_SRC |
|
717 |
*** Racket |
|
718 |
**** Major mode |
|
719 |
#+BEGIN_SRC emacs-lisp |
|
720 |
(when (eq system-type 'windows-nt) |
|
721 |
(add-to-list 'exec-path "c:/Program Files/Racket") |
|
722 |
(setenv "PATH" (mapconcat #'identity exec-path path-separator))) |
|
723 |
|
|
724 |
(use-package racket-mode |
|
725 |
:ensure t |
|
726 |
:config |
|
727 |
(autoload 'racket-mode "Racket" "Racket Editing Mode" t) |
|
728 |
(add-to-list |
|
729 |
'auto-mode-alist |
|
730 |
'("\\.rkt$" . matlab-mode)) |
|
731 |
(setq matlab-indent-function t)) |
|
732 |
#+END_SRC |
|
733 |
|
0b811a
|
734 |
* Org mode |
d070a7
|
735 |
** Up to date org |
C |
736 |
#+BEGIN_SRC emacs-lisp |
|
737 |
(use-package org |
|
738 |
:ensure t |
|
739 |
:pin org) |
|
740 |
#+END_SRC |
|
741 |
** Small tweaks |
|
742 |
#+BEGIN_SRC emacs-lisp |
|
743 |
(setq org-src-fontify-natively t) |
|
744 |
(setq org-src-tab-acts-natively t) |
|
745 |
(setq org-confirm-babel-evaluate nil) |
|
746 |
(setq org-export-with-smart-quotes t) |
|
747 |
(setq org-src-window-setup 'current-window) |
|
748 |
(add-hook 'org-mode-hook 'org-indent-mode) |
1650a5
|
749 |
(diminish 'org-indent-mode) |
C |
750 |
(diminish 'visual-line-mode) |
d070a7
|
751 |
#+END_SRC |
C |
752 |
** Line wrapping |
|
753 |
#+BEGIN_SRC emacs-lisp |
|
754 |
(add-hook 'org-mode-hook |
|
755 |
'(lambda () |
|
756 |
(visual-line-mode 1))) |
|
757 |
#+END_SRC |
|
758 |
** org-bullets |
|
759 |
#+BEGIN_SRC emacs-lisp |
|
760 |
(use-package org-bullets |
|
761 |
:ensure t |
|
762 |
:config |
|
763 |
(add-hook 'org-mode-hook (lambda () (org-bullets-mode)))) |
|
764 |
#+END_SRC |