unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Creating new major mode
@ 2008-09-23  9:28 Paulo Jorge Matos
  2008-09-23 18:58 ` Nikolaj Schumacher
       [not found] ` <EMEW-k8MK2cf73177e81b278b031d7d8b57c991f680-m263om664x.fsf@nschum.de>
  0 siblings, 2 replies; 6+ messages in thread
From: Paulo Jorge Matos @ 2008-09-23  9:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I have been working on a new major mode and it is striking me that, for 
example, lisp-mode doesn't use generic-mode or derived-mode. It seems to 
define just a couple of functions which set specific parameters. When 
should generic-modes or derived-modes be created?

Any tutorial on creating new major modes around?

Cheers,
-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Creating new major mode
  2008-09-23  9:28 Creating new major mode Paulo Jorge Matos
@ 2008-09-23 18:58 ` Nikolaj Schumacher
       [not found] ` <EMEW-k8MK2cf73177e81b278b031d7d8b57c991f680-m263om664x.fsf@nschum.de>
  1 sibling, 0 replies; 6+ messages in thread
From: Nikolaj Schumacher @ 2008-09-23 18:58 UTC (permalink / raw)
  To: Paulo Jorge Matos; +Cc: help-gnu-emacs

Paulo Jorge Matos <pocm@soton.ac.uk> wrote:

> When should generic-modes or derived-modes be created?

Generally, I suggest you just derive any mode from fundamental-mode.
That takes care of most the house keeping, and you'll only need to add
what you actually want.

Maybe you should look at more recent and smaller modes than lisp-mode to
learn.  Look around in the Emacs Wiki.


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Creating new major mode
       [not found] ` <EMEW-k8MK2cf73177e81b278b031d7d8b57c991f680-m263om664x.fsf@nschum.de>
@ 2008-09-24  9:05   ` Paulo Jorge Matos
  2008-09-24 15:06     ` Nikolaj Schumacher
  0 siblings, 1 reply; 6+ messages in thread
From: Paulo Jorge Matos @ 2008-09-24  9:05 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

Nikolaj Schumacher wrote:
> Paulo Jorge Matos <pocm@soton.ac.uk> wrote:
> 
>> When should generic-modes or derived-modes be created?
> 
> Generally, I suggest you just derive any mode from fundamental-mode.
> That takes care of most the house keeping, and you'll only need to add
> what you actually want.
> 
> Maybe you should look at more recent and smaller modes than lisp-mode to
> learn.  Look around in the Emacs Wiki.
> 

Thank you. It seems then that the issue is that some modes predate the 
existence of the derived-mode API. New modes should use though, right?

I will check the wiki out for new modes, thanks! :)

> 
> regards,
> Nikolaj Schumacher
> 
> 


-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Creating new major mode
  2008-09-24  9:05   ` Paulo Jorge Matos
@ 2008-09-24 15:06     ` Nikolaj Schumacher
  2008-09-24 21:52       ` Paulo J. Matos
       [not found]       ` <mailman.19863.1222293135.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Nikolaj Schumacher @ 2008-09-24 15:06 UTC (permalink / raw)
  To: Paulo Jorge Matos; +Cc: help-gnu-emacs

Paulo Jorge Matos <pocm@soton.ac.uk> wrote:

> Thank you. It seems then that the issue is that some modes predate the
> existence of the derived-mode API. New modes should use though, right?

Well, "should" is relative.  I absolutely suggest it, but it's strictly
optional.  Some newer modes also elect not to use it.

Maybe take a look at the bundled css-mode.  It's not too big and has a
typical design.


regards,
Nikolaj Schumacher




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Creating new major mode
  2008-09-24 15:06     ` Nikolaj Schumacher
@ 2008-09-24 21:52       ` Paulo J. Matos
       [not found]       ` <mailman.19863.1222293135.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Paulo J. Matos @ 2008-09-24 21:52 UTC (permalink / raw)
  To: Nikolaj Schumacher; +Cc: help-gnu-emacs

On Wed, Sep 24, 2008 at 4:06 PM, Nikolaj Schumacher <me@nschum.de> wrote:
> Paulo Jorge Matos <pocm@soton.ac.uk> wrote:
>
>> Thank you. It seems then that the issue is that some modes predate the
>> existence of the derived-mode API. New modes should use though, right?
>
> Well, "should" is relative.  I absolutely suggest it, but it's strictly
> optional.  Some newer modes also elect not to use it.
>
> Maybe take a look at the bundled css-mode.  It's not too big and has a
> typical design.
>

Thanks for the tip, I will look at it! :)

>
> regards,
> Nikolaj Schumacher
>
>
>



-- 
Paulo Jorge Matos - pocm at ecs.soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Creating new major mode
       [not found]       ` <mailman.19863.1222293135.18990.help-gnu-emacs@gnu.org>
@ 2008-09-25  5:36         ` Tim X
  0 siblings, 0 replies; 6+ messages in thread
From: Tim X @ 2008-09-25  5:36 UTC (permalink / raw)
  To: help-gnu-emacs

"Paulo J. Matos" <pocm@ecs.soton.ac.uk> writes:

> On Wed, Sep 24, 2008 at 4:06 PM, Nikolaj Schumacher <me@nschum.de> wrote:
>> Paulo Jorge Matos <pocm@soton.ac.uk> wrote:
>>
>>> Thank you. It seems then that the issue is that some modes predate the
>>> existence of the derived-mode API. New modes should use though, right?
>>
>> Well, "should" is relative.  I absolutely suggest it, but it's strictly
>> optional.  Some newer modes also elect not to use it.
>>
>> Maybe take a look at the bundled css-mode.  It's not too big and has a
>> typical design.
>>
>
> Thanks for the tip, I will look at it! :)
>

The other nice thing about using derived mode et al is that you can get
a lot of functionality for free. For example, if you derive from a mode
that has the same basic formatting requirements as your new mode, then
you only need to tweak things rather than re-invent from scratch. 
It can be a lot less work and result in a lot less you need to maintain.

Tim


-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-25  5:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23  9:28 Creating new major mode Paulo Jorge Matos
2008-09-23 18:58 ` Nikolaj Schumacher
     [not found] ` <EMEW-k8MK2cf73177e81b278b031d7d8b57c991f680-m263om664x.fsf@nschum.de>
2008-09-24  9:05   ` Paulo Jorge Matos
2008-09-24 15:06     ` Nikolaj Schumacher
2008-09-24 21:52       ` Paulo J. Matos
     [not found]       ` <mailman.19863.1222293135.18990.help-gnu-emacs@gnu.org>
2008-09-25  5:36         ` Tim X

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).