* How to write a major mode?
@ 2003-08-21 17:50 Arjan Bos
2003-08-21 18:23 ` Phillip Lord
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Arjan Bos @ 2003-08-21 17:50 UTC (permalink / raw)
Hi all,
Are there any pointers to documentation that show me how to program my
own major mode? We created our own language with antlr, and of course we
want it font-locked and indented automatically from within emacs.
1) Which functions do I need to create?
2) Are there any elisp docs out there that could help me with those
function?
3) What is the best way to provide indenting and font-locking?
Is there a small, well documented major-mode that I can use as a basis?
These are a lot of questions. I hope I get answers to them all ;-)
TIA
Arjan Bos
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-21 17:50 How to write a major mode? Arjan Bos
@ 2003-08-21 18:23 ` Phillip Lord
2003-08-27 20:16 ` Kai Großjohann
2003-08-21 18:24 ` Lute Kamstra
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Phillip Lord @ 2003-08-21 18:23 UTC (permalink / raw)
>>>>> "Arjan" == Arjan Bos <Arjan.Bos@icu.nl> writes:
Arjan> Hi all,
Arjan> Are there any pointers to documentation that show me how to
Arjan> program my own major mode? We created our own language with
Arjan> antlr, and of course we want it font-locked and indented
Arjan> automatically from within emacs.
Arjan> 1) Which functions do I need to create?
Arjan> 2) Are there any elisp docs out there that could help me with
Arjan> those
Arjan> function?
Arjan> 3) What is the best way to provide indenting and
Arjan> font-locking?
Arjan> Is there a small, well documented major-mode that I can use
Arjan> as a basis?
Arjan> These are a lot of questions. I hope I get answers to them
Arjan> all ;-)
There is a emacs lisp primer, and manual, which you can get from the
GNU sites. They are both fairly good. There is also, of course, of lot
of source, much of which is well documented which you can read.
In your case I think you want to take a look at "generic.el" and
"generic-x.el" which are designed for building small major modes, with
font locking, and indentation.
Phil
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-21 18:23 ` Phillip Lord
@ 2003-08-27 20:16 ` Kai Großjohann
2003-08-28 10:59 ` Phillip Lord
0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-08-27 20:16 UTC (permalink / raw)
Phillip Lord <p.lord@russet.org.uk> writes:
> In your case I think you want to take a look at "generic.el" and
> "generic-x.el" which are designed for building small major modes, with
> font locking, and indentation.
Does generic.el do indentation?
--
Two cafe au lait please, but without milk.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-27 20:16 ` Kai Großjohann
@ 2003-08-28 10:59 ` Phillip Lord
0 siblings, 0 replies; 10+ messages in thread
From: Phillip Lord @ 2003-08-28 10:59 UTC (permalink / raw)
>>>>> "Kai" == Kai Großjohann <kai.grossjohann@gmx.net> writes:
Kai> Phillip Lord <p.lord@russet.org.uk> writes:
>> In your case I think you want to take a look at "generic.el" and
>> "generic-x.el" which are designed for building small major modes,
>> with font locking, and indentation.
Kai> Does generic.el do indentation?
No it doesn't. My mistake.
indent.el does do indentation however, and there are a couple of
functions in there which will be good for many new modes.
Phil
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-21 17:50 How to write a major mode? Arjan Bos
2003-08-21 18:23 ` Phillip Lord
@ 2003-08-21 18:24 ` Lute Kamstra
2003-08-21 20:54 ` Johan Bockgård
2003-08-21 23:53 ` Alex Schroeder
2003-08-26 18:40 ` Arjan Bos
2003-08-27 20:18 ` Kai Großjohann
3 siblings, 2 replies; 10+ messages in thread
From: Lute Kamstra @ 2003-08-21 18:24 UTC (permalink / raw)
Arjan Bos <Arjan.Bos@icu.nl> writes:
> Are there any pointers to documentation that show me how to program
> my own major mode? We created our own language with antlr, and of
> course we want it font-locked and indented automatically from within
> emacs.
>
> 1) Which functions do I need to create?
> 2) Are there any elisp docs out there that could help me with those
> function?
> 3) What is the best way to provide indenting and font-locking?
The Emacs Lisp Reference Manual has a chapter about writing major
modes. If I recall correctly, http://www.emacswiki.org has some
useful information as well.
> Is there a small, well documented major-mode that I can use as a
> basis?
Take a look at some of the major modes that come with Emacs. An
example of a small mode is text-mode (lisp/textmodes/text-mode.el).
Lute.
--
(spook) => "militia benelux New World Order"
(insert-file-contents "~/.signature") => (error "`~/.signature' too rude")
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-21 17:50 How to write a major mode? Arjan Bos
2003-08-21 18:23 ` Phillip Lord
2003-08-21 18:24 ` Lute Kamstra
@ 2003-08-26 18:40 ` Arjan Bos
2003-08-28 13:49 ` Rob Thorpe
2003-08-27 20:18 ` Kai Großjohann
3 siblings, 1 reply; 10+ messages in thread
From: Arjan Bos @ 2003-08-26 18:40 UTC (permalink / raw)
Many thanks to all that replied! Emacs wiki, the sample mode and the
mode tutorial proved very usedful indeed. Next to that, a colleague of
mine turned up with an O'Reilly book on customizing emacs. It deals with
gnu-emacs 19.18, but I quess that the principles haven't changed that much.
Again, thanks for all the fantastic info
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: How to write a major mode?
2003-08-21 17:50 How to write a major mode? Arjan Bos
` (2 preceding siblings ...)
2003-08-26 18:40 ` Arjan Bos
@ 2003-08-27 20:18 ` Kai Großjohann
3 siblings, 0 replies; 10+ messages in thread
From: Kai Großjohann @ 2003-08-27 20:18 UTC (permalink / raw)
In addition to the suggestions from the others, see the node
"(elisp)Major Modes" in Info.
You will have to download and install the Emacs Lisp Reference
manual, available from ftp.gnu.org and its mirrors.
Then, C-h i and then g and then enter the above node name, terminated
with RET.
--
Two cafe au lait please, but without milk.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-08-28 13:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-21 17:50 How to write a major mode? Arjan Bos
2003-08-21 18:23 ` Phillip Lord
2003-08-27 20:16 ` Kai Großjohann
2003-08-28 10:59 ` Phillip Lord
2003-08-21 18:24 ` Lute Kamstra
2003-08-21 20:54 ` Johan Bockgård
2003-08-21 23:53 ` Alex Schroeder
2003-08-26 18:40 ` Arjan Bos
2003-08-28 13:49 ` Rob Thorpe
2003-08-27 20:18 ` Kai Großjohann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).