aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/erlang.el
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tools/emacs/erlang.el')
-rw-r--r--lib/tools/emacs/erlang.el20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 2972906dcb..aff2c4b2c9 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -897,6 +897,7 @@ resulting regexp is surrounded by \\_< and \\_>."
"get_module_info"
"get_stacktrace"
"hash"
+ "has_prepared_code_on_load"
"hibernate"
"insert_element"
"is_builtin"
@@ -1354,7 +1355,7 @@ Lock syntax table. The effect is that `apply' in the atom
(funcall (symbol-function 'interactive-p))))
;;;###autoload
-(defun erlang-mode ()
+(define-derived-mode erlang-mode prog-mode "Erlang"
"Major mode for editing Erlang source files in Emacs.
It knows about syntax and comment, it can indent code, it is capable
of fontifying the source file, the TAGS commands are aware of Erlang
@@ -1413,12 +1414,9 @@ and examples of hooks.
Other commands:
\\{erlang-mode-map}"
- (interactive)
- (kill-all-local-variables)
- (setq major-mode 'erlang-mode)
- (setq mode-name "Erlang")
+ ;; Use our own syntax table function
+ :syntax-table nil
(erlang-syntax-table-init)
- (use-local-map erlang-mode-map)
(erlang-electric-init)
(erlang-menu-init)
(erlang-mode-variables)
@@ -1433,10 +1431,7 @@ Other commands:
(add-hook 'xref-backend-functions #'erlang-etags--xref-backend nil t))
(run-hooks 'erlang-mode-hook)
(if (zerop (buffer-size))
- (run-hooks 'erlang-new-file-hook))
- ;; Doesn't exist in Emacs v21.4; required by Emacs v23.
- (if (boundp 'after-change-major-mode-hook)
- (run-hooks 'after-change-major-mode-hook)))
+ (run-hooks 'erlang-new-file-hook)))
;;;###autoload
(dolist (r '("\\.erl$" "\\.app\\.src$" "\\.escript"
@@ -2992,8 +2987,9 @@ Return nil if inside string, t if in a comment."
(current-column)))
;; Type and Spec indentation
((eq (car stack-top) '::)
- (if (looking-at "}")
- ;; Closing record definition with types
+ (if (looking-at "[},)]")
+ ;; Closing function spec, record definition with types,
+ ;; or a comma at the start of the line
;; pop stack and recurse
(erlang-calculate-stack-indent indent-point
(cons (erlang-pop stack) (cdr state)))