What are some resources for learning to write a major mode for a programming language such as Haskell? I know such things exist but I would like to learn how to do it, it seems like a fun and interesting project.
1 Answer
There is a section of the Elisp manual specifically about this. I'd recommend that you start by reading that.
After that, I'd recommend that you look at the code for some simple major modes that come with Emacs. Emulating such code is a good way to start out, and to learn.
I'd also recommend that you read the parent section of that section, and other sibling sections (other subsections of the parent).
For example, you will see this in that parent node (Major Modes):
The standard GNU Emacs Lisp directory tree contains the code for several major modes, in files such as
text-mode.el
,texinfo.el
,lisp-mode.el
, andrmail.el
. You can study these libraries to see how modes are written.
(define-derived-mode ...)
. With(define-derived-mode my-mode prog-mode ...)
if there is nothing better. Just a comment. I know that this does not answer the question.