/
emacs-rc-erlang.el
55 lines (44 loc) · 1.62 KB
/
emacs-rc-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
;;; emacs-rc-erlang.el ---
;; Copyright (C) 2008 Alex Ott
;;
;; Author: alexott@gmail.com
(add-to-list 'load-path "~/emacs/erlang-mode")
(require 'erlang-start)
(require 'erlang-flymake)
(add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(defun alexott/erlang-mode-hook ()
;; when starting an Erlang shell in Emacs, default in the node name
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; add Erlang functions to an imenu menu
(imenu-add-to-menubar "imenu")
(when (and buffer-file-name
(string-match "flymake" buffer-file-name))
(flymake-mode -1))
(local-set-key [return] 'newline-and-indent)
)
(add-hook 'erlang-mode-hook 'alexott/erlang-mode-hook)
(eval-after-load "erlang-skels"
(progn
(setq erlang-skel-mail-address "alexott@gmail.com")))
(when (locate-library "distel")
(require 'distel)
(distel-setup))
(setq alexott/wrangler-path (file-name-as-directory (expand-file-name "~/projects/wrangler")))
(when (file-exists-p alexott/wrangler-path)
(add-to-list 'load-path (concat alexott/wrangler-path "elisp"))
(require 'wrangler)
)
(defun alexott/get-erlang-app-dir ()
(let* ((src-path (file-name-directory (buffer-file-name)))
(pos (string-match "/src/" src-path)))
(if pos
(substring src-path 0 (+ 1 pos))
src-path)))
;; (setq erlang-flymake-get-code-path-dirs-function
;; (lambda ()
;; (concat (alexott/get-erlang-app-dir) "ebin")))
;; (setq erlang-flymake-get-code-include-dirs-function
;; (lambda ()
;; (concat (alexott/get-erlang-app-dir) "include")))
;;; emacs-rc-erlang.el ends here