parent
aa56498955
commit
62f7057c8d
20
MODES
20
MODES
|
@ -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?
|
||||
|
||||
|
|
Loading…
Reference in New Issue