branch : pmacs2
This commit is contained in:
moculus 2007-10-18 21:12:11 +00:00
parent aa56498955
commit 62f7057c8d
1 changed files with 7 additions and 13 deletions

20
MODES
View File

@ -11,21 +11,15 @@ inherit.
2. Where do they come from?
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.
Loading a module involves the following (in Application.__init__):
Modes are loaded and installed by application.py, or by $HOME/.pmc/conf, which
is sourced by application.py. To install a mode, import its class from the
package in which it resides, and call install() on the class, passing the
application as the only argument. Example:
self.modes['foo'] = package.Foo
import mymode
mymode.ModeClass.install(self)
# ...
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.
This code can be run in application.py's constructor, or in $HOME/.pmc/conf.
3. How do they work?