From 71a6beee8eda8c0cd0638b7dc1659841f67f5980 Mon Sep 17 00:00:00 2001 From: moculus Date: Wed, 25 Jul 2007 20:52:48 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- MODES | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/MODES b/MODES index 01cc3ca..cf7f717 100644 --- a/MODES +++ b/MODES @@ -9,18 +9,22 @@ buffer should be indented, and any other per-buffer configuration. The default mode ("Fundamental") provides the base functionality which all other modes 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: +Loading a module involves the following (in Application.__init__): - # mandatory; modename should be lowercase - self.modes[modename] = package.ModeClass + + self.modes['foo'] = package.Foo - # specify full paths which should use this mode - self.mode_paths['/some/full/path'] = 'modename' - # specify filenames (i.e. .bashrc) which should use this mode - self.mode_basenames['filename'] = 'modename' - # specify file extensions (i.e. .txt) which should use this mode - self.mode_extensions['.junk'] = 'modename' - # specify executable name in comment (i.e. bash from #!/usr/bin/bash) - self.mode_detection['junk'] = 'modename' + # ... + + 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?