2007-07-24 09:35:27 -04:00
|
|
|
This document is designed to be a quick (and incomplete) description of how
|
|
|
|
modes work, how you might create one yourself, etc.
|
|
|
|
|
|
|
|
1. What are modes?
|
|
|
|
|
|
|
|
Pmacs uses modes to determine what actions can be applied to a buffer, which
|
|
|
|
keys should apply which actions, how the buffer should be highlighted, how the
|
|
|
|
buffer should be indented, and any other per-buffer configuration. The default
|
|
|
|
mode ("Fundamental") provides the base functionality which all other modes
|
|
|
|
inherit.
|
|
|
|
|
2007-07-25 16:52:48 -04:00
|
|
|
2. Where do they come from?
|
|
|
|
|
2007-07-24 09:35:27 -04:00
|
|
|
All modes are loaded and installed in application.py. It would be nice if there
|
|
|
|
was a configuration file where you could add your own modes, but there isn't.
|
2007-07-25 16:52:48 -04:00
|
|
|
Loading a module involves the following (in Application.__init__):
|
|
|
|
|
|
|
|
|
|
|
|
self.modes['foo'] = package.Foo
|
|
|
|
|
|
|
|
# ...
|
|
|
|
|
|
|
|
self.mode_paths['/some/full/path'] = 'foo'
|
|
|
|
self.mode_basenames['some-filename'] = 'foo'
|
|
|
|
self.mode_extensions['.foo'] = 'foo'
|
|
|
|
self.mode_detection['foo'] = 'foo'
|
|
|
|
|
|
|
|
The last is for detecting scripts using the "#!/usr/bin/foo" syntax.
|
|
|
|
|
|
|
|
3. How do they work?
|