erlang-mode is not a derived prog-mode.
Is there any way to make it part of the prog-mode-hook ?
erlang-mode is not a derived prog-mode.
Is there any way to make it part of the prog-mode-hook ?
All you have to do is add (run-hooks 'prog-mode-hook)
to erlang-mode-hook
:
(add-hook 'erlang-mode-hook
(lambda () (run-hooks 'prog-mode-hook)))
You should place this after anything else you add to erlang-mode-hook
to make sure prog-mode-hook
gets called before anything else. That way erlang-mode
can clobber any settings in prog-mode
that it doesn't like.
In addition to answers given by @erikstokes and @Abbrev, you might want to add the following:
(put 'erlang-mode 'derived-mode-parent 'prog-mode)
It ensures that (derived-mode-p 'prog-mode)
returns t
for Erlang mode. This is useful since there are a number of utilities that are enabled for all modes that inherit from Prog mode.
However, a more permanent solution would be to lobby to the Erlang team to replace the old definition of erlang-mode
with the following, more modern version (and drop some of the stuff this provides for free):
(if (fboundp 'prog-mode)
(defmacro erlang-define-derived-mode (mode &rest args)
`(define-derived-mode ,mode prog-mode ,@args))
(defmacro erlang-define-derived-mode (mode &rest args)
`(define-derived-mode ,mode nil ,@args)))
(erlang-define-derived-mode erlang-mode "Erlang"
...)
(Should someone decide to lobby for this, you can say "Anders Lindgren, the author of Erlang mode, suggested this.")
erlang-mode
probably doesn't inherit prog-mode-abbrev-table
correctly, so any abbrevs you create for prog-mode won't work. Fix like so:
(eval-after-load erlang-mode
(abbrev-table-put erlang-abbrev-table
:parents (list prog-mode-abbrev-table)))
This bug is shared by python-mode
and lisp-mode
, and they ship with Emacs!