parent
aa56498955
commit
62f7057c8d
20
MODES
20
MODES
|
@ -11,21 +11,15 @@ inherit.
|
||||||
|
|
||||||
2. Where do they come from?
|
2. Where do they come from?
|
||||||
|
|
||||||
All modes are loaded and installed in application.py. It would be nice if there
|
Modes are loaded and installed by application.py, or by $HOME/.pmc/conf, which
|
||||||
was a configuration file where you could add your own modes, but there isn't.
|
is sourced by application.py. To install a mode, import its class from the
|
||||||
Loading a module involves the following (in Application.__init__):
|
package in which it resides, and call install() on the class, passing the
|
||||||
|
application as the only argument. Example:
|
||||||
|
|
||||||
|
import mymode
|
||||||
self.modes['foo'] = package.Foo
|
mymode.ModeClass.install(self)
|
||||||
|
|
||||||
# ...
|
This code can be run in application.py's constructor, or in $HOME/.pmc/conf.
|
||||||
|
|
||||||
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?
|
3. How do they work?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue