forked from technomancy/emacs-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs.backup.090318
61 lines (54 loc) · 2.13 KB
/
.emacs.backup.090318
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
(setq load-path (cons "/localdisk/data/erlang/lib/erlang/lib/tools-2.6.2/emacs"
load-path))
(setq erlang-root-dir "/localdisk/data/erlang/lib/erlang")
(setq exec-path (cons "/localdisk/data/erlang/bin" exec-path))
(setq erlang-man-root-dir "/localdisk/data/erlang/lib/erlang/man")
(require 'erlang-start)
(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(defun my-erlang-mode-hook ()
;; when starting an Erlang shell in Emacs, default in the node name
(setq inferior-erlang-machine-options '("-sname" "distel@localhost"))
;; add Erlang functions to an imenu menu
(imenu-add-to-menubar "imenu")
;; customize keys
(local-set-key [return] 'newline-and-indent)
)
;; Some Erlang customizations
(add-hook 'erlang-mode-hook 'my-erlang-mode-hook)
(add-to-list 'load-path "/usr/local/share/distel/elisp")
(require 'distel)
(distel-setup)
;; 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)))))
(add-hook 'erlang-mode-hook
'(lambda ()
(unless erl-nodename-cache
(distel-load-shell))))
(defun distel-load-shell ()
"Load/reload the erlang shell connection to a distel node"
(interactive)
;; Set default distel node name
(setq erl-nodename-cache 'distel@localhost)
(setq distel-modeline-node "distel")
(force-mode-line-update)
;; Start up an inferior erlang with node name `distel'
(let ((file-buffer (current-buffer))
(file-window (selected-window)))
(setq inferior-erlang-machine-options '("-sname" "distel@localhost"))
(switch-to-buffer-other-window file-buffer)
(inferior-erlang)
(select-window file-window)
(switch-to-buffer file-buffer)))