aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2016-04-06 15:20:22 +0100
committerMagnus Henoch <[email protected]>2016-04-16 23:49:48 +0100
commite3a71ace30edc91d50adf54106c0b0c274156231 (patch)
tree3aa8fdba3a1200c4948a5ea31b6d50743a0920cc /lib
parente1489c448b7486cdcfec6a89fea238d88e6ce2f3 (diff)
downloadotp-e3a71ace30edc91d50adf54106c0b0c274156231.tar.gz
otp-e3a71ace30edc91d50adf54106c0b0c274156231.tar.bz2
otp-e3a71ace30edc91d50adf54106c0b0c274156231.zip
Use define-derived-mode to define erlang-mode
Remove some things that define-derived-mode does for us. Also, derive erlang-mode from prog-mode, so that a user that has added customizations meant for all programming language major modes will enjoy those in Erlang mode as well.
Diffstat (limited to 'lib')
-rw-r--r--lib/tools/emacs/erlang.el15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 466bf139b9..ace8bb2dc1 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -1344,7 +1344,7 @@ Lock syntax table. The effect is that `apply' in the atom
;;;###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
@@ -1403,12 +1403,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)
@@ -1418,12 +1415,8 @@ Other commands:
(erlang-font-lock-init)
(erlang-skel-init)
(tempo-use-tag-list 'erlang-tempo-tags)
- (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"