-
Notifications
You must be signed in to change notification settings - Fork 2
/
init-erlang.el
59 lines (47 loc) · 1.77 KB
/
init-erlang.el
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
;;; init-erlang.el --- Configure Erlang mode and Distel
;;; Erlang mode
(setq erlang-root-dir "/usr/local/erlware")
(require 'erlang-start)
(setq auto-mode-alist
(append
'(("\\.app$" . erlang-mode)
("\\.config$" . erlang-mode))
auto-mode-alist))
(add-hook 'erlang-mode-hook
(lambda ()
(coding-hook)
;; Bind RET to newline-and-indent and bind C-j to just newline...
(define-key erlang-mode-map [return] 'newline-and-indent)
(define-key erlang-mode-map [(control j)] 'newline)))
;;; Distel
(require 'distel)
(distel-setup)
;; prevent annoying hang-on-compile
(defvar inferior-erlang-prompt-timeout t)
;; default node name to emacs@localhost
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; tell distel to default to that node
(setq erl-nodename-cache
(make-symbol
(concat
"emacs@"
;; Mac OS X uses "name.local" instead of "name", this should work
;; pretty much anywhere without having to muck with NetInfo
;; ... but I only tested it on Mac OS X.
(car (split-string (shell-command-to-string "hostname"))))))
;; A number of the erlang-extended-mode key bindings are useful in the shell too
(defconst distel-shell-keys
'(("\C-\M-i" erl-complete)
("\M-?" erl-complete)
("\M-." erl-find-source-under-point)
("\M-," erl-find-source-unwind)
("\M-*" erl-find-source-unwind)
)
"Additional keys to bind when in Erlang shell.")
(add-hook 'erlang-shell-mode-hook
(lambda ()
;; add some Distel bindings to the Erlang shell
(dolist (spec distel-shell-keys)
(define-key erlang-shell-mode-map (car spec) (cadr spec)))))
(provide 'init-erlang)
;; init-erlang.el ends here