-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseline.emacs
96 lines (78 loc) · 3.39 KB
/
baseline.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
;; baseline config file for erlang development in emacs ------------------------
(require 'whitespace)
;; make whitespace-mode use just basic coloring
(setq whitespace-style
(quote (face tabs trailing lines-trail lines whitespace-line)))
(setq global-whitespace-mode t)
(setq whitespace-tab ((((class color) (background light)) (:background "green" :foreground "lightgray"))))
(setq-default indent-tabs-mode nil)
(add-to-list
'load-path
(car (file-expand-wildcards "/usr/lib/erlang/lib/tools-*/emacs")))
(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/lib/bin" exec-path))
(require 'erlang-start)
;; short host name, like `hostname -s`, remote shell likes this better
(defun short-host-name ()
(string-match "[^\.]+" system-name)
(substring system-name (match-beginning 0) (match-end 0)))
;; set default nodename for distel (= also for erlang-shell-remote)
(setq erl-nodename-cache (intern (concat "dev" "@" (short-host-name))))
;; makes compiling set paths each time, needed for compiling in remote shell
(setq erlang-compile-use-outdir nil)
;; awesome remote shell function
(defun remote-erlang-shell ()
(interactive)
(let* ((inferior-erlang-machine-options
(list "-sname" "emacs"
"-remsh" (format "%s" erl-nodename-cache))))
(erlang-shell-display)))
;; setup flymake for erlang-mode (requires fly-compile-erlang in ~/.emacs.d)
(require 'flymake)
(defun flymake-erlang-init ()
(let*((temp-file (flymake-init-create-temp-buffer-copy
'flymake-create-temp-inplace))
(local-file (file-relative-name temp-file
(file-name-directory buffer-file-name))))
(list "~/.emacs.d/fly-compile-erlang"
(list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
'("\\.erl\\'" flymake-erlang-init))
(add-hook 'erlang-mode-hook 'flymake-mode)
;; add paths to wrangler and distel, require wrangler which also requires distel
(add-to-list 'load-path "<PATH_TO_WRANGLER>/elisp")
(add-to-list 'load-path "<PATH_TO_DISTEL>/elisp")
(require 'wrangler)
;; setup extra keybindings
(defun load-extra-erlang-mode-bindings ()
(define-key erlang-mode-map (kbd "C-c C-d M") 'erlang-man-function)
(define-prefix-command 'ctrl-c-ctrl-z-keymap)
(define-key erlang-mode-map (kbd "C-c C-z") 'ctrl-c-ctrl-z-keymap)
(define-key ctrl-c-ctrl-z-keymap (kbd "z") 'erlang-shell-display)
(define-key ctrl-c-ctrl-z-keymap (kbd "r") 'erlang-shell-remote))
(add-hook 'erlang-mode-hook 'load-extra-erlang-mode-bindings)
;; ========== Make ===============
(setq compile-command "make -k -C ../../..")
(global-set-key (kbd "<f7>") 'recompile)
;; ========== Key Bindings =======
(global-set-key (kbd "<f6>") 'erl-reload-modules)
(global-set-key [(control next)] 'other-window)
(global-set-key [(control prior)]
(lambda ()
(interactive)
(other-window -1)))
(global-set-key (kbd "<f4>")
(lambda ()
(interactive)
(delete-other-windows)
(split-window-horizontally)
(split-window-horizontally)
(other-window -1)
(split-window-vertically)
(balance-windows)
(other-window 2)))
;; Printing
(setq ps-paper-type (quote a4))
;; ========== Magit! =============
;;(require 'magit)
;;(global-set-key (kbd "<f8>") 'magit-status)