-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathedts-start.el
76 lines (63 loc) · 2.36 KB
/
edts-start.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
;;; edts-start.el --- EDTS auto-activation and starting.
;; Copyright 2012-2013 Thomas Järvstrand <[email protected]>
;; Author: Thomas Järvstrand <[email protected]>
;; Keywords: erlang
;; This file is not part of GNU Emacs.
;;
;; This file is part of EDTS.
;;
;; EDTS is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Lesser General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; EDTS is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public License
;; along with EDTS. If not, see <http://www.gnu.org/licenses/>.
(require 'erlang)
(require 'f)
(defcustom edts-inhibit-package-check nil
"If non-nil, don't check whether EDTS was installed as a package."
:type 'boolean
:group 'edts)
(unless (or edts-inhibit-package-check
(and (boundp 'package-alist)
(assoc 'edts package-alist)))
(warn (concat
"EDTS was not installed as a package.\n"
"\n"
"Please see the README for details on installing EDTS from MELPA.\n"
"\n"
"If you know what you're doing and have all the necessary dependencies\n"
"installed (see edts-pkg.el) you can disable this check by setting\n"
"`edts-inhibit-package-check' to a non-nil value."))
(when (y-or-n-p "Do you want to disable package check now?")
(customize-save-variable 'edts-inhibit-package-check t)))
(let* ((top-dir (f-dirname (f-this-file)))
(dirs (f-directories (f-expand "elisp" top-dir))))
(-each dirs (lambda (d) (add-to-list 'load-path d t))))
(require 'edts-mode)
(defun edts-erlang-mode-hook ()
(when (buffer-file-name)
(edts-mode t)))
(add-hook 'erlang-mode-hook 'edts-erlang-mode-hook)
(defcustom edts-erlang-mode-regexps
'("^\\.erlang$"
"\\.app$"
"\\.app.src$"
"\\.erl$"
"\\.es$"
"\\.escript$"
"\\.eterm$"
"\\.script$"
"\\.yaws$")
"File-name patterns for which to auto-activate edts-mode."
:type '(repeat regexp)
:group 'edts)
(mapc #'(lambda(re) (add-to-list 'auto-mode-alist (cons re 'erlang-mode)))
edts-erlang-mode-regexps)
(provide 'edts-start)