parent
b0f40259d6
commit
aa56498955
123
application.py
123
application.py
|
@ -84,90 +84,47 @@ class Application(object):
|
||||||
self.set_error("Dynamic color not available")
|
self.set_error("Dynamic color not available")
|
||||||
|
|
||||||
# initialize our modes
|
# initialize our modes
|
||||||
self.modes = {
|
# the first dict stores our modes by (lowercase) name, and the other
|
||||||
'blame': mode.blame.Blame,
|
# dicts all store various ways to "auto-detecting" the correct mode,
|
||||||
'c': mode.c.C,
|
# in the precedence with which they are used.
|
||||||
'console': mode.console.Console,
|
self.modes = {}
|
||||||
'consolemini': mode.consolemini.Console,
|
self.mode_paths = {}
|
||||||
'diff': mode.diff.Diff,
|
self.mode_basenames = {}
|
||||||
'dir': mode.dir.Dir,
|
self.mode_extensions = {}
|
||||||
'fundamental': mode2.Fundamental,
|
self.mode_detection = {}
|
||||||
'mini': mode.mini.Mini,
|
|
||||||
'nasm': mode.nasm.Nasm,
|
|
||||||
'perl': mode.perl.Perl,
|
|
||||||
'python': mode.python.Python,
|
|
||||||
'replace': mode.replace.Replace,
|
|
||||||
'search': mode.search.Search,
|
|
||||||
'sh': mode.sh.Sh,
|
|
||||||
'text': mode.text.Text,
|
|
||||||
'text2': mode.text2.Text2,
|
|
||||||
'which': mode.which.Which,
|
|
||||||
'xml': mode.xml.XML,
|
|
||||||
'html': mode.html.HTML,
|
|
||||||
'css': mode.css.CSS,
|
|
||||||
'mutt': mode.mutt.Mutt,
|
|
||||||
'javascript': mode.javascript.Javascript,
|
|
||||||
'sql': mode.sql.Sql,
|
|
||||||
'template': mode.tt.Template,
|
|
||||||
#'bds': mode.bds.BDS,
|
|
||||||
'rst': mode.rst.RST,
|
|
||||||
'java': mode.java.Java,
|
|
||||||
'hex': mode.hex.Hex,
|
|
||||||
'make': mode.make.Make,
|
|
||||||
|
|
||||||
'ocaml': mode.ocaml.Ocaml,
|
mode2.Fundamental.install(self)
|
||||||
|
mode.blame.Blame.install(self)
|
||||||
# lisp dialects
|
mode.c.C.install(self)
|
||||||
'lisp': mode.lisp.Lisp,
|
mode.console.Console.install(self)
|
||||||
'scheme': mode.scheme.Scheme,
|
mode.consolemini.ConsoleMini.install(self)
|
||||||
'elisp': mode.elisp.ELisp,
|
mode.css.CSS.install(self)
|
||||||
}
|
mode.diff.Diff.install(self)
|
||||||
|
mode.dir.Dir.install(self)
|
||||||
# these are used in this order to determine which mode to open certain
|
mode.elisp.ELisp.install(self)
|
||||||
# kinds of files
|
mode.hex.Hex.install(self)
|
||||||
self.mode_paths = {
|
mode.html.HTML.install(self)
|
||||||
'/etc/profile': 'sh',
|
mode.java.Java.install(self)
|
||||||
}
|
mode.javascript.Javascript.install(self)
|
||||||
self.mode_basenames = {
|
mode.lisp.Lisp.install(self)
|
||||||
'.bashrc': 'sh',
|
mode.make.Make.install(self)
|
||||||
'.bash_profile': 'sh',
|
mode.mini.Mini.install(self)
|
||||||
'.profile': 'sh',
|
mode.mutt.Mutt.install(self)
|
||||||
#'components.xml': 'bds',
|
mode.nasm.Nasm.install(self)
|
||||||
'.emacs': 'elisp',
|
mode.ocaml.Ocaml.install(self)
|
||||||
'Makefile': 'make',
|
mode.perl.Perl.install(self)
|
||||||
}
|
mode.python.Python.install(self)
|
||||||
self.mode_extensions = {
|
mode.replace.Replace.install(self)
|
||||||
'.py': 'python',
|
mode.rst.RST.install(self)
|
||||||
'.pl': 'perl',
|
mode.scheme.Scheme.install(self)
|
||||||
'.pm': 'perl',
|
mode.search.Search.install(self)
|
||||||
'.t': 'perl',
|
mode.sh.Sh.install(self)
|
||||||
'.c': 'c',
|
mode.sql.Sql.install(self)
|
||||||
#'.txt': 'text',
|
mode.tt.Template.install(self)
|
||||||
'.txt': 'text2',
|
mode.text.Text.install(self)
|
||||||
'.s': 'nasm',
|
mode.text2.Text2.install(self)
|
||||||
'.sh': 'sh',
|
mode.which.Which.install(self)
|
||||||
'.bash': 'sh',
|
mode.xml.XML.install(self)
|
||||||
'.xml': 'xml',
|
|
||||||
'.xml.in': 'xml',
|
|
||||||
'.html': 'html',
|
|
||||||
'.htm': 'html',
|
|
||||||
'.js': 'javascript',
|
|
||||||
'.sql': 'sql',
|
|
||||||
'.tt': 'template',
|
|
||||||
'.css': 'css',
|
|
||||||
'.rst': 'rst',
|
|
||||||
'.java': 'java',
|
|
||||||
'.el': 'elisp',
|
|
||||||
'.scm': 'scheme',
|
|
||||||
'.mli': 'ocaml',
|
|
||||||
'.ml': 'ocaml',
|
|
||||||
}
|
|
||||||
self.mode_detection = {
|
|
||||||
'python': 'python',
|
|
||||||
'perl': 'perl',
|
|
||||||
'sh': 'sh',
|
|
||||||
'bash': 'sh',
|
|
||||||
}
|
|
||||||
|
|
||||||
# initialize our methods
|
# initialize our methods
|
||||||
self.methods = {}
|
self.methods = {}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* framebuffer driver for Intel Based Mac's
|
* framebuffer driver for Intel Based Mac's
|
||||||
*
|
*
|
||||||
* (c) 2006 Edgar Hucek <gimli@dark-green.com>
|
* (c) 2006 Edgar Hucek <gimli@dark-green.com>
|
||||||
* Original imac driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
|
* Original imac driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de>
|
||||||
*
|
*
|
||||||
|
@ -23,39 +23,39 @@
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
|
|
||||||
#define dac_reg (0x3c8)
|
#define dac_reg (0x3c8)
|
||||||
#define dac_val (0x3c9)
|
#define dac_val (0x3c9)
|
||||||
|
|
||||||
typedef enum _MAC_TAPE {
|
typedef enum _MAC_TAPE {
|
||||||
M_I17,
|
M_I17,
|
||||||
M_I20,
|
M_I20,
|
||||||
M_MINI,
|
M_MINI,
|
||||||
M_NEW
|
M_NEW
|
||||||
} MAC_TAPE;
|
} MAC_TAPE;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct fb_var_screeninfo imacfb_defined __initdata = {
|
static struct fb_var_screeninfo imacfb_defined __initdata = {
|
||||||
.activate = FB_ACTIVATE_NOW,
|
.activate = FB_ACTIVATE_NOW,
|
||||||
.height = -1,
|
.height = -1,
|
||||||
.width = -1,
|
.width = -1,
|
||||||
.right_margin = 32,
|
.right_margin = 32,
|
||||||
.upper_margin = 16,
|
.upper_margin = 16,
|
||||||
.lower_margin = 4,
|
.lower_margin = 4,
|
||||||
.vsync_len = 4,
|
.vsync_len = 4,
|
||||||
.vmode = FB_VMODE_NONINTERLACED,
|
.vmode = FB_VMODE_NONINTERLACED,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct fb_fix_screeninfo imacfb_fix __initdata = {
|
static struct fb_fix_screeninfo imacfb_fix __initdata = {
|
||||||
.id = "IMAC VGA",
|
.id = "IMAC VGA",
|
||||||
.type = FB_TYPE_PACKED_PIXELS,
|
.type = FB_TYPE_PACKED_PIXELS,
|
||||||
.accel = FB_ACCEL_NONE,
|
.accel = FB_ACCEL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int inverse = 0;
|
static int inverse = 0;
|
||||||
static int mtrr = 0; /* disable mtrr */
|
static int mtrr = 0; /* disable mtrr */
|
||||||
static int vram_remap __initdata = 0; /* Set amount of memory to be used */
|
static int vram_remap __initdata = 0; /* Set amount of memory to be used */
|
||||||
static int vram_total __initdata = 0; /* Set total amount of memory */
|
static int vram_total __initdata = 0; /* Set total amount of memory */
|
||||||
static int depth;
|
static int depth;
|
||||||
static int model = M_NEW;
|
static int model = M_NEW;
|
||||||
static int manual_height = 0;
|
static int manual_height = 0;
|
||||||
|
@ -64,361 +64,361 @@ static int manual_width = 0;
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int imacfb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
static int imacfb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
unsigned blue, unsigned transp,
|
unsigned blue, unsigned transp,
|
||||||
struct fb_info *info)
|
struct fb_info *info)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Set a single color register. The values supplied are
|
* Set a single color register. The values supplied are
|
||||||
* already rounded down to the hardware's capabilities
|
* already rounded down to the hardware's capabilities
|
||||||
* (according to the entries in the `var' structure). Return
|
* (according to the entries in the `var' structure). Return
|
||||||
* != 0 for invalid regno.
|
* != 0 for invalid regno.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (regno >= info->cmap.len)
|
if (regno >= info->cmap.len)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (regno < 16 && info->var.bits_per_pixel != 8) {
|
if (regno < 16 && info->var.bits_per_pixel != 8) {
|
||||||
switch (info->var.bits_per_pixel) {
|
switch (info->var.bits_per_pixel) {
|
||||||
case 16:
|
case 16:
|
||||||
if (info->var.red.offset == 10) {
|
if (info->var.red.offset == 10) {
|
||||||
/* 1:5:5:5 */
|
/* 1:5:5:5 */
|
||||||
((u32*) (info->pseudo_palette))[regno] =
|
((u32*) (info->pseudo_palette))[regno] =
|
||||||
((red & 0xf800) >> 1) |
|
((red & 0xf800) >> 1) |
|
||||||
((green & 0xf800) >> 6) |
|
((green & 0xf800) >> 6) |
|
||||||
((blue & 0xf800) >> 11);
|
((blue & 0xf800) >> 11);
|
||||||
} else {
|
} else {
|
||||||
/* 0:5:6:5 */
|
/* 0:5:6:5 */
|
||||||
((u32*) (info->pseudo_palette))[regno] =
|
((u32*) (info->pseudo_palette))[regno] =
|
||||||
((red & 0xf800) ) |
|
((red & 0xf800) ) |
|
||||||
((green & 0xfc00) >> 5) |
|
((green & 0xfc00) >> 5) |
|
||||||
((blue & 0xf800) >> 11);
|
((blue & 0xf800) >> 11);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
case 32:
|
case 32:
|
||||||
red >>= 8;
|
red >>= 8;
|
||||||
green >>= 8;
|
green >>= 8;
|
||||||
blue >>= 8;
|
blue >>= 8;
|
||||||
((u32 *)(info->pseudo_palette))[regno] =
|
((u32 *)(info->pseudo_palette))[regno] =
|
||||||
(red << info->var.red.offset) |
|
(red << info->var.red.offset) |
|
||||||
(green << info->var.green.offset) |
|
(green << info->var.green.offset) |
|
||||||
(blue << info->var.blue.offset);
|
(blue << info->var.blue.offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct fb_ops imacfb_ops = {
|
static struct fb_ops imacfb_ops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.fb_setcolreg = imacfb_setcolreg,
|
.fb_setcolreg = imacfb_setcolreg,
|
||||||
.fb_fillrect = cfb_fillrect,
|
.fb_fillrect = cfb_fillrect,
|
||||||
.fb_copyarea = cfb_copyarea,
|
.fb_copyarea = cfb_copyarea,
|
||||||
.fb_imageblit = cfb_imageblit,
|
.fb_imageblit = cfb_imageblit,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init imacfb_setup(char *options)
|
static int __init imacfb_setup(char *options)
|
||||||
{
|
{
|
||||||
char *this_opt;
|
char *this_opt;
|
||||||
|
|
||||||
if (!options || !*options)
|
if (!options || !*options)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while ((this_opt = strsep(&options, ",")) != NULL) {
|
while ((this_opt = strsep(&options, ",")) != NULL) {
|
||||||
if (!*this_opt) continue;
|
if (!*this_opt) continue;
|
||||||
|
|
||||||
if (! strcmp(this_opt, "inverse"))
|
if (! strcmp(this_opt, "inverse"))
|
||||||
inverse=1;
|
inverse=1;
|
||||||
else if (! strncmp(this_opt, "mtrr:", 5))
|
else if (! strncmp(this_opt, "mtrr:", 5))
|
||||||
mtrr = simple_strtoul(this_opt+5, NULL, 0);
|
mtrr = simple_strtoul(this_opt+5, NULL, 0);
|
||||||
else if (! strcmp(this_opt, "nomtrr"))
|
else if (! strcmp(this_opt, "nomtrr"))
|
||||||
mtrr=0;
|
mtrr=0;
|
||||||
else if (! strncmp(this_opt, "vtotal:", 7))
|
else if (! strncmp(this_opt, "vtotal:", 7))
|
||||||
vram_total = simple_strtoul(this_opt+7, NULL, 0);
|
vram_total = simple_strtoul(this_opt+7, NULL, 0);
|
||||||
else if (! strncmp(this_opt, "vremap:", 7))
|
else if (! strncmp(this_opt, "vremap:", 7))
|
||||||
vram_remap = simple_strtoul(this_opt+7, NULL, 0);
|
vram_remap = simple_strtoul(this_opt+7, NULL, 0);
|
||||||
else if (! strcmp(this_opt, "i17"))
|
else if (! strcmp(this_opt, "i17"))
|
||||||
model = M_I17;
|
model = M_I17;
|
||||||
else if (! strcmp(this_opt, "i20"))
|
else if (! strcmp(this_opt, "i20"))
|
||||||
model = M_I20;
|
model = M_I20;
|
||||||
else if (! strcmp(this_opt, "mini"))
|
else if (! strcmp(this_opt, "mini"))
|
||||||
model = M_MINI;
|
model = M_MINI;
|
||||||
else if (! strncmp(this_opt, "height:", 7))
|
else if (! strncmp(this_opt, "height:", 7))
|
||||||
manual_height = simple_strtoul(this_opt+7, NULL, 0);
|
manual_height = simple_strtoul(this_opt+7, NULL, 0);
|
||||||
else if (! strncmp(this_opt, "width:", 6))
|
else if (! strncmp(this_opt, "width:", 6))
|
||||||
manual_width = simple_strtoul(this_opt+6, NULL, 0);
|
manual_width = simple_strtoul(this_opt+6, NULL, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFAULT_FB_MEM 1024*1024*16
|
#define DEFAULT_FB_MEM 1024*1024*16
|
||||||
|
|
||||||
static int __init imacfb_probe(struct platform_device *dev)
|
static int __init imacfb_probe(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
struct fb_info *info;
|
struct fb_info *info;
|
||||||
int err;
|
int err;
|
||||||
unsigned int size_vmode;
|
unsigned int size_vmode;
|
||||||
unsigned int size_remap;
|
unsigned int size_remap;
|
||||||
unsigned int size_total;
|
unsigned int size_total;
|
||||||
|
|
||||||
screen_info.lfb_base = 0x80010000;
|
screen_info.lfb_base = 0x80010000;
|
||||||
screen_info.lfb_depth = 32;
|
screen_info.lfb_depth = 32;
|
||||||
screen_info.lfb_size = DEFAULT_FB_MEM / 0x10000;
|
screen_info.lfb_size = DEFAULT_FB_MEM / 0x10000;
|
||||||
screen_info.pages=1;
|
screen_info.pages=1;
|
||||||
screen_info.blue_size = 8;
|
screen_info.blue_size = 8;
|
||||||
screen_info.blue_pos = 0;
|
screen_info.blue_pos = 0;
|
||||||
screen_info.green_size = 8;
|
screen_info.green_size = 8;
|
||||||
screen_info.green_pos = 8;
|
screen_info.green_pos = 8;
|
||||||
screen_info.red_size = 8;
|
screen_info.red_size = 8;
|
||||||
screen_info.red_pos = 16;
|
screen_info.red_pos = 16;
|
||||||
screen_info.rsvd_size = 8;
|
screen_info.rsvd_size = 8;
|
||||||
screen_info.rsvd_pos = 24;
|
screen_info.rsvd_pos = 24;
|
||||||
|
|
||||||
switch(model) {
|
switch(model) {
|
||||||
case M_I17:
|
case M_I17:
|
||||||
screen_info.lfb_width = 1440;
|
screen_info.lfb_width = 1440;
|
||||||
screen_info.lfb_height = 900;
|
screen_info.lfb_height = 900;
|
||||||
screen_info.lfb_linelength = 1472 * 4;
|
screen_info.lfb_linelength = 1472 * 4;
|
||||||
break;
|
break;
|
||||||
case M_NEW:
|
case M_NEW:
|
||||||
case M_I20:
|
case M_I20:
|
||||||
screen_info.lfb_width = 1680;
|
screen_info.lfb_width = 1680;
|
||||||
screen_info.lfb_height = 1050;
|
screen_info.lfb_height = 1050;
|
||||||
screen_info.lfb_linelength = 1728 * 4;
|
screen_info.lfb_linelength = 1728 * 4;
|
||||||
break;
|
break;
|
||||||
case M_MINI:
|
case M_MINI:
|
||||||
screen_info.lfb_width = 1024;
|
screen_info.lfb_width = 1024;
|
||||||
screen_info.lfb_height = 768;
|
screen_info.lfb_height = 768;
|
||||||
screen_info.lfb_linelength = 2048 * 4;
|
screen_info.lfb_linelength = 2048 * 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the user wants to manually specify height/width,
|
/* if the user wants to manually specify height/width,
|
||||||
we will override the defaults */
|
we will override the defaults */
|
||||||
/* TODO: eventually get auto-detection working */
|
/* TODO: eventually get auto-detection working */
|
||||||
if(manual_height > 0)
|
if(manual_height > 0)
|
||||||
screen_info.lfb_height = manual_height;
|
screen_info.lfb_height = manual_height;
|
||||||
if(manual_width > 0)
|
if(manual_width > 0)
|
||||||
screen_info.lfb_width = manual_width;
|
screen_info.lfb_width = manual_width;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
static void *videomemory;
|
static void *videomemory;
|
||||||
static u_long videomemorysize = (64*1024*1024);
|
static u_long videomemorysize = (64*1024*1024);
|
||||||
videomemory = ioremap(0x80000000,videomemorysize);
|
videomemory = ioremap(0x80000000,videomemorysize);
|
||||||
memset(videomemory, 0x99, videomemorysize);
|
memset(videomemory, 0x99, videomemorysize);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
imacfb_fix.smem_start = screen_info.lfb_base;
|
imacfb_fix.smem_start = screen_info.lfb_base;
|
||||||
imacfb_defined.bits_per_pixel = screen_info.lfb_depth;
|
imacfb_defined.bits_per_pixel = screen_info.lfb_depth;
|
||||||
if (15 == imacfb_defined.bits_per_pixel)
|
if (15 == imacfb_defined.bits_per_pixel)
|
||||||
imacfb_defined.bits_per_pixel = 16;
|
imacfb_defined.bits_per_pixel = 16;
|
||||||
imacfb_defined.xres = screen_info.lfb_width;
|
imacfb_defined.xres = screen_info.lfb_width;
|
||||||
imacfb_defined.yres = screen_info.lfb_height;
|
imacfb_defined.yres = screen_info.lfb_height;
|
||||||
imacfb_fix.line_length = screen_info.lfb_linelength;
|
imacfb_fix.line_length = screen_info.lfb_linelength;
|
||||||
imacfb_fix.visual = (imacfb_defined.bits_per_pixel == 8) ?
|
imacfb_fix.visual = (imacfb_defined.bits_per_pixel == 8) ?
|
||||||
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
|
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR;
|
||||||
|
|
||||||
/* size_vmode -- that is the amount of memory needed for the
|
/* size_vmode -- that is the amount of memory needed for the
|
||||||
* used video mode, i.e. the minimum amount of
|
* used video mode, i.e. the minimum amount of
|
||||||
* memory we need. */
|
* memory we need. */
|
||||||
size_vmode = imacfb_defined.yres * imacfb_fix.line_length;
|
size_vmode = imacfb_defined.yres * imacfb_fix.line_length;
|
||||||
|
|
||||||
/* size_total -- all video memory we have. Used for mtrr
|
/* size_total -- all video memory we have. Used for mtrr
|
||||||
* entries, ressource allocation and bounds
|
* entries, ressource allocation and bounds
|
||||||
* checking. */
|
* checking. */
|
||||||
size_total = screen_info.lfb_size * 65536;
|
size_total = screen_info.lfb_size * 65536;
|
||||||
if (vram_total)
|
if (vram_total)
|
||||||
size_total = vram_total * 1024 * 1024;
|
size_total = vram_total * 1024 * 1024;
|
||||||
if (size_total < size_vmode)
|
if (size_total < size_vmode)
|
||||||
size_total = size_vmode;
|
size_total = size_vmode;
|
||||||
|
|
||||||
/* size_remap -- the amount of video memory we are going to
|
/* size_remap -- the amount of video memory we are going to
|
||||||
* use for imacfb. With modern cards it is no
|
* use for imacfb. With modern cards it is no
|
||||||
* option to simply use size_total as that
|
* option to simply use size_total as that
|
||||||
* wastes plenty of kernel address space. */
|
* wastes plenty of kernel address space. */
|
||||||
size_remap = size_vmode * 2;
|
size_remap = size_vmode * 2;
|
||||||
if (vram_remap)
|
if (vram_remap)
|
||||||
size_remap = vram_remap * 1024 * 1024;
|
size_remap = vram_remap * 1024 * 1024;
|
||||||
if (size_remap < size_vmode)
|
if (size_remap < size_vmode)
|
||||||
size_remap = size_vmode;
|
size_remap = size_vmode;
|
||||||
if (size_remap > size_total)
|
if (size_remap > size_total)
|
||||||
size_remap = size_total;
|
size_remap = size_total;
|
||||||
imacfb_fix.smem_len = size_remap;
|
imacfb_fix.smem_len = size_remap;
|
||||||
|
|
||||||
#ifndef __i386__
|
#ifndef __i386__
|
||||||
screen_info.imacpm_seg = 0;
|
screen_info.imacpm_seg = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
|
if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"imacfb: cannot reserve video memory at 0x%lx\n",
|
"imacfb: cannot reserve video memory at 0x%lx\n",
|
||||||
imacfb_fix.smem_start);
|
imacfb_fix.smem_start);
|
||||||
/* We cannot make this fatal. Sometimes this comes from magic
|
/* We cannot make this fatal. Sometimes this comes from magic
|
||||||
spaces our resource handlers simply don't know about */
|
spaces our resource handlers simply don't know about */
|
||||||
}
|
}
|
||||||
|
|
||||||
info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
|
info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
release_mem_region(imacfb_fix.smem_start, size_total);
|
release_mem_region(imacfb_fix.smem_start, size_total);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
info->pseudo_palette = info->par;
|
info->pseudo_palette = info->par;
|
||||||
info->par = NULL;
|
info->par = NULL;
|
||||||
|
|
||||||
info->screen_base = ioremap(imacfb_fix.smem_start, imacfb_fix.smem_len);
|
info->screen_base = ioremap(imacfb_fix.smem_start, imacfb_fix.smem_len);
|
||||||
if (!info->screen_base) {
|
if (!info->screen_base) {
|
||||||
printk(KERN_ERR
|
printk(KERN_ERR
|
||||||
"imacfb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
|
"imacfb: abort, cannot ioremap video memory 0x%x @ 0x%lx\n",
|
||||||
imacfb_fix.smem_len, imacfb_fix.smem_start);
|
imacfb_fix.smem_len, imacfb_fix.smem_start);
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "imacfb: framebuffer at 0x%lx, mapped to 0x%p, "
|
printk(KERN_INFO "imacfb: framebuffer at 0x%lx, mapped to 0x%p, "
|
||||||
"using %dk, total %dk\n",
|
"using %dk, total %dk\n",
|
||||||
imacfb_fix.smem_start, info->screen_base,
|
imacfb_fix.smem_start, info->screen_base,
|
||||||
size_remap/1024, size_total/1024);
|
size_remap/1024, size_total/1024);
|
||||||
printk(KERN_INFO "imacfb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
|
printk(KERN_INFO "imacfb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
|
||||||
imacfb_defined.xres, imacfb_defined.yres, imacfb_defined.bits_per_pixel, imacfb_fix.line_length, screen_info.pages);
|
imacfb_defined.xres, imacfb_defined.yres, imacfb_defined.bits_per_pixel, imacfb_fix.line_length, screen_info.pages);
|
||||||
|
|
||||||
imacfb_defined.xres_virtual = imacfb_defined.xres;
|
imacfb_defined.xres_virtual = imacfb_defined.xres;
|
||||||
imacfb_defined.yres_virtual = imacfb_fix.smem_len / imacfb_fix.line_length;
|
imacfb_defined.yres_virtual = imacfb_fix.smem_len / imacfb_fix.line_length;
|
||||||
printk(KERN_INFO "imacfb: scrolling: redraw\n");
|
printk(KERN_INFO "imacfb: scrolling: redraw\n");
|
||||||
imacfb_defined.yres_virtual = imacfb_defined.yres;
|
imacfb_defined.yres_virtual = imacfb_defined.yres;
|
||||||
|
|
||||||
/* some dummy values for timing to make fbset happy */
|
/* some dummy values for timing to make fbset happy */
|
||||||
imacfb_defined.pixclock = 10000000 / imacfb_defined.xres * 1000 / imacfb_defined.yres;
|
imacfb_defined.pixclock = 10000000 / imacfb_defined.xres * 1000 / imacfb_defined.yres;
|
||||||
imacfb_defined.left_margin = (imacfb_defined.xres / 8) & 0xf8;
|
imacfb_defined.left_margin = (imacfb_defined.xres / 8) & 0xf8;
|
||||||
imacfb_defined.hsync_len = (imacfb_defined.xres / 8) & 0xf8;
|
imacfb_defined.hsync_len = (imacfb_defined.xres / 8) & 0xf8;
|
||||||
|
|
||||||
imacfb_defined.red.offset = screen_info.red_pos;
|
imacfb_defined.red.offset = screen_info.red_pos;
|
||||||
imacfb_defined.red.length = screen_info.red_size;
|
imacfb_defined.red.length = screen_info.red_size;
|
||||||
imacfb_defined.green.offset = screen_info.green_pos;
|
imacfb_defined.green.offset = screen_info.green_pos;
|
||||||
imacfb_defined.green.length = screen_info.green_size;
|
imacfb_defined.green.length = screen_info.green_size;
|
||||||
imacfb_defined.blue.offset = screen_info.blue_pos;
|
imacfb_defined.blue.offset = screen_info.blue_pos;
|
||||||
imacfb_defined.blue.length = screen_info.blue_size;
|
imacfb_defined.blue.length = screen_info.blue_size;
|
||||||
imacfb_defined.transp.offset = screen_info.rsvd_pos;
|
imacfb_defined.transp.offset = screen_info.rsvd_pos;
|
||||||
imacfb_defined.transp.length = screen_info.rsvd_size;
|
imacfb_defined.transp.length = screen_info.rsvd_size;
|
||||||
|
|
||||||
if (imacfb_defined.bits_per_pixel <= 8) {
|
if (imacfb_defined.bits_per_pixel <= 8) {
|
||||||
depth = imacfb_defined.green.length;
|
depth = imacfb_defined.green.length;
|
||||||
imacfb_defined.red.length =
|
imacfb_defined.red.length =
|
||||||
imacfb_defined.green.length =
|
imacfb_defined.green.length =
|
||||||
imacfb_defined.blue.length =
|
imacfb_defined.blue.length =
|
||||||
imacfb_defined.bits_per_pixel;
|
imacfb_defined.bits_per_pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO "imacfb: %s: "
|
printk(KERN_INFO "imacfb: %s: "
|
||||||
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
|
"size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n",
|
||||||
(imacfb_defined.bits_per_pixel > 8) ?
|
(imacfb_defined.bits_per_pixel > 8) ?
|
||||||
"Truecolor" : "Pseudocolor",
|
"Truecolor" : "Pseudocolor",
|
||||||
screen_info.rsvd_size,
|
screen_info.rsvd_size,
|
||||||
screen_info.red_size,
|
screen_info.red_size,
|
||||||
screen_info.green_size,
|
screen_info.green_size,
|
||||||
screen_info.blue_size,
|
screen_info.blue_size,
|
||||||
screen_info.rsvd_pos,
|
screen_info.rsvd_pos,
|
||||||
screen_info.red_pos,
|
screen_info.red_pos,
|
||||||
screen_info.green_pos,
|
screen_info.green_pos,
|
||||||
screen_info.blue_pos);
|
screen_info.blue_pos);
|
||||||
|
|
||||||
imacfb_fix.ypanstep = 0;
|
imacfb_fix.ypanstep = 0;
|
||||||
imacfb_fix.ywrapstep = 0;
|
imacfb_fix.ywrapstep = 0;
|
||||||
|
|
||||||
/* request failure does not faze us, as vgacon probably has this
|
/* request failure does not faze us, as vgacon probably has this
|
||||||
* region already (FIXME) */
|
* region already (FIXME) */
|
||||||
request_region(0x3c0, 32, "imacfb");
|
request_region(0x3c0, 32, "imacfb");
|
||||||
|
|
||||||
#ifdef CONFIG_MTRR
|
#ifdef CONFIG_MTRR
|
||||||
if (mtrr) {
|
if (mtrr) {
|
||||||
unsigned int temp_size = size_total;
|
unsigned int temp_size = size_total;
|
||||||
unsigned int type = 0;
|
unsigned int type = 0;
|
||||||
|
|
||||||
switch (mtrr) {
|
switch (mtrr) {
|
||||||
case 1:
|
case 1:
|
||||||
type = MTRR_TYPE_UNCACHABLE;
|
type = MTRR_TYPE_UNCACHABLE;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
type = MTRR_TYPE_WRBACK;
|
type = MTRR_TYPE_WRBACK;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
type = MTRR_TYPE_WRCOMB;
|
type = MTRR_TYPE_WRCOMB;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
type = MTRR_TYPE_WRTHROUGH;
|
type = MTRR_TYPE_WRTHROUGH;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
type = 0;
|
type = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Find the largest power-of-two */
|
/* Find the largest power-of-two */
|
||||||
while (temp_size & (temp_size - 1))
|
while (temp_size & (temp_size - 1))
|
||||||
temp_size &= (temp_size - 1);
|
temp_size &= (temp_size - 1);
|
||||||
|
|
||||||
/* Try and find a power of two to add */
|
/* Try and find a power of two to add */
|
||||||
do {
|
do {
|
||||||
rc = mtrr_add(imacfb_fix.smem_start, temp_size,
|
rc = mtrr_add(imacfb_fix.smem_start, temp_size,
|
||||||
type, 1);
|
type, 1);
|
||||||
temp_size >>= 1;
|
temp_size >>= 1;
|
||||||
} while (temp_size >= PAGE_SIZE && rc == -EINVAL);
|
} while (temp_size >= PAGE_SIZE && rc == -EINVAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
info->fbops = &imacfb_ops;
|
info->fbops = &imacfb_ops;
|
||||||
info->var = imacfb_defined;
|
info->var = imacfb_defined;
|
||||||
info->fix = imacfb_fix;
|
info->fix = imacfb_fix;
|
||||||
info->flags = FBINFO_FLAG_DEFAULT;
|
info->flags = FBINFO_FLAG_DEFAULT;
|
||||||
|
|
||||||
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (register_framebuffer(info)<0) {
|
if (register_framebuffer(info)<0) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
fb_dealloc_cmap(&info->cmap);
|
fb_dealloc_cmap(&info->cmap);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
printk(KERN_INFO "fb%d: %s frame buffer device\n",
|
printk(KERN_INFO "fb%d: %s frame buffer device\n",
|
||||||
info->node, info->fix.id);
|
info->node, info->fix.id);
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
release_mem_region(imacfb_fix.smem_start, size_total);
|
release_mem_region(imacfb_fix.smem_start, size_total);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver imacfb_driver = {
|
static struct platform_driver imacfb_driver = {
|
||||||
.probe = imacfb_probe,
|
.probe = imacfb_probe,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "imacfb",
|
.name = "imacfb",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device imacfb_device = {
|
static struct platform_device imacfb_device = {
|
||||||
.name = "imacfb",
|
.name = "imacfb",
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init imacfb_init(void)
|
static int __init imacfb_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char *option = NULL;
|
char *option = NULL;
|
||||||
|
|
||||||
/* ignore error return of fb_get_options */
|
/* ignore error return of fb_get_options */
|
||||||
fb_get_options("imacfb", &option);
|
fb_get_options("imacfb", &option);
|
||||||
imacfb_setup(option);
|
imacfb_setup(option);
|
||||||
ret = platform_driver_register(&imacfb_driver);
|
ret = platform_driver_register(&imacfb_driver);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = platform_device_register(&imacfb_device);
|
ret = platform_device_register(&imacfb_device);
|
||||||
if (ret)
|
if (ret)
|
||||||
platform_driver_unregister(&imacfb_driver);
|
platform_driver_unregister(&imacfb_driver);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
module_init(imacfb_init);
|
module_init(imacfb_init);
|
||||||
|
|
||||||
|
|
12
mode/bds.py
12
mode/bds.py
|
@ -23,12 +23,14 @@ class BDSGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class BDS(mode2.Fundamental):
|
class BDS(mode2.Fundamental):
|
||||||
grammar = BDSGrammar
|
modename = 'BDS'
|
||||||
|
basenames = ['components.xml']
|
||||||
|
grammar = BDSGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
# comments
|
# comments
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
|
@ -64,8 +66,6 @@ class BDS(mode2.Fundamental):
|
||||||
self.add_action(BDSMakeInstall())
|
self.add_action(BDSMakeInstall())
|
||||||
self.add_action(BDSCompileResources())
|
self.add_action(BDSCompileResources())
|
||||||
self.add_action(BDSRestart())
|
self.add_action(BDSRestart())
|
||||||
def name(self):
|
|
||||||
return "BDS"
|
|
||||||
|
|
||||||
class BDSMakeInstall(Method):
|
class BDSMakeInstall(Method):
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
|
|
|
@ -15,11 +15,10 @@ class BlameGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Blame(mode2.Fundamental):
|
class Blame(mode2.Fundamental):
|
||||||
|
modename = 'Blame'
|
||||||
grammar = BlameGrammar
|
grammar = BlameGrammar
|
||||||
colors = {
|
colors = {
|
||||||
'metadata.start': ('blue', 'default', 'bold'),
|
'metadata.start': ('blue', 'default', 'bold'),
|
||||||
'metadata.username': ('cyan', 'default', 'bold'),
|
'metadata.username': ('cyan', 'default', 'bold'),
|
||||||
'metadata.end': ('green', 'default', 'bold'),
|
'metadata.end': ('green', 'default', 'bold'),
|
||||||
}
|
}
|
||||||
def name(self):
|
|
||||||
return "Blame"
|
|
||||||
|
|
14
mode/c.py
14
mode/c.py
|
@ -176,13 +176,15 @@ class CTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class C(mode2.Fundamental):
|
class C(mode2.Fundamental):
|
||||||
tabbercls = CTabber
|
modename = 'C'
|
||||||
grammar = CGrammar
|
extensions = ['.c']
|
||||||
|
tabbercls = CTabber
|
||||||
|
grammar = CGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'macrocomment.start': ('red', 'default'),
|
'macrocomment.start': ('red', 'default'),
|
||||||
'macrocomment.null': ('red', 'default'),
|
'macrocomment.null': ('red', 'default'),
|
||||||
'macrocomment.end': ('red', 'default'),
|
'macrocomment.end': ('red', 'default'),
|
||||||
|
@ -240,8 +242,6 @@ class C(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(CMake(), ('C-c C-c',))
|
self.add_action_and_bindings(CMake(), ('C-c C-c',))
|
||||||
self.add_action_and_bindings(CSetMake(), ('C-c M-m',))
|
self.add_action_and_bindings(CSetMake(), ('C-c M-m',))
|
||||||
self.makecmd = "make"
|
self.makecmd = "make"
|
||||||
def name(self):
|
|
||||||
return "C"
|
|
||||||
|
|
||||||
class CSetMake(method.Method):
|
class CSetMake(method.Method):
|
||||||
'''Set the path(s) to find perl modules'''
|
'''Set the path(s) to find perl modules'''
|
||||||
|
|
|
@ -14,6 +14,7 @@ class ConsoleGrammar(Grammar):
|
||||||
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
]
|
]
|
||||||
class Console(mode2.Fundamental):
|
class Console(mode2.Fundamental):
|
||||||
|
modename = 'Console'
|
||||||
grammar = ConsoleGrammar()
|
grammar = ConsoleGrammar()
|
||||||
colors = {
|
colors = {
|
||||||
'mesg': ('blue', 'default'),
|
'mesg': ('blue', 'default'),
|
||||||
|
@ -26,5 +27,3 @@ class Console(mode2.Fundamental):
|
||||||
'string.null': ('green', 'default'),
|
'string.null': ('green', 'default'),
|
||||||
'string.end': ('green', 'default'),
|
'string.end': ('green', 'default'),
|
||||||
}
|
}
|
||||||
def name(self):
|
|
||||||
return "Console"
|
|
||||||
|
|
|
@ -3,7 +3,8 @@ import color, completer, method, mode2
|
||||||
from lex3 import Grammar, PatternRule
|
from lex3 import Grammar, PatternRule
|
||||||
from point2 import Point
|
from point2 import Point
|
||||||
|
|
||||||
class Console(mode2.Fundamental):
|
class ConsoleMini(mode2.Fundamental):
|
||||||
|
modename = 'ConsoleMini'
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
self.bindings = {}
|
self.bindings = {}
|
||||||
|
@ -48,8 +49,6 @@ class Console(mode2.Fundamental):
|
||||||
#self.add_action_and_bindings(ConsoleTab(), ('TAB',))
|
#self.add_action_and_bindings(ConsoleTab(), ('TAB',))
|
||||||
for c in string.letters + string.digits + string.punctuation:
|
for c in string.letters + string.digits + string.punctuation:
|
||||||
self.add_binding('insert-string-%s' % c, c)
|
self.add_binding('insert-string-%s' % c, c)
|
||||||
def name(self):
|
|
||||||
return "Console"
|
|
||||||
|
|
||||||
class ConsoleExec(method.Method):
|
class ConsoleExec(method.Method):
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
|
|
|
@ -42,8 +42,10 @@ class CSSGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class CSS(mode2.Fundamental):
|
class CSS(mode2.Fundamental):
|
||||||
grammar = CSSGrammar
|
modename = 'CSS'
|
||||||
colors = {
|
extensions = ['.css']
|
||||||
|
grammar = CSSGrammar
|
||||||
|
colors = {
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
|
@ -89,5 +91,3 @@ class CSS(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Javascript"
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ class DiffGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Diff(mode2.Fundamental):
|
class Diff(mode2.Fundamental):
|
||||||
|
modename = 'diff'
|
||||||
grammar = DiffGrammar()
|
grammar = DiffGrammar()
|
||||||
colors = {
|
colors = {
|
||||||
'left': ('red', 'default', 'bold'),
|
'left': ('red', 'default', 'bold'),
|
||||||
|
@ -24,8 +25,6 @@ class Diff(mode2.Fundamental):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
#self.add_action_and_bindings(DiffNextSection(), ('M-n', 'M-D_ARROW',))
|
#self.add_action_and_bindings(DiffNextSection(), ('M-n', 'M-D_ARROW',))
|
||||||
#self.add_action_and_bindings(DiffPreviousSection(), ('M-p', 'M-U_ARROW',))
|
#self.add_action_and_bindings(DiffPreviousSection(), ('M-p', 'M-U_ARROW',))
|
||||||
def name(self):
|
|
||||||
return "Diff"
|
|
||||||
|
|
||||||
class DiffNextSection(method.Method):
|
class DiffNextSection(method.Method):
|
||||||
re = re.compile("(?:^|(?<=\n))@@ [-+0-9a-z, ]* @@(?:$|\n)")
|
re = re.compile("(?:^|(?<=\n))@@ [-+0-9a-z, ]* @@(?:$|\n)")
|
||||||
|
|
|
@ -36,6 +36,7 @@ class DirGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Dir(mode2.Fundamental):
|
class Dir(mode2.Fundamental):
|
||||||
|
modename = 'Dir'
|
||||||
grammar = DirGrammar()
|
grammar = DirGrammar()
|
||||||
colors = {
|
colors = {
|
||||||
'blk.start': ('cyan', 'default'),
|
'blk.start': ('cyan', 'default'),
|
||||||
|
@ -74,8 +75,6 @@ class Dir(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(Chgrp(), ('C-c g',))
|
self.add_action_and_bindings(Chgrp(), ('C-c g',))
|
||||||
self.add_action_and_bindings(TouchPath(), ('C-c t',))
|
self.add_action_and_bindings(TouchPath(), ('C-c t',))
|
||||||
self.add_action_and_bindings(RemovePath(), ('DELETE', 'BACKSPACE', 'C-d'))
|
self.add_action_and_bindings(RemovePath(), ('DELETE', 'BACKSPACE', 'C-d'))
|
||||||
def name(self):
|
|
||||||
return "Dir"
|
|
||||||
|
|
||||||
class RefreshView(Method):
|
class RefreshView(Method):
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
|
|
|
@ -29,13 +29,16 @@ class ELispTabber(tab2.StackTabber):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class ELisp(mode2.Fundamental):
|
class ELisp(mode2.Fundamental):
|
||||||
|
modename = 'ELisp'
|
||||||
|
basenames = ['.emacs']
|
||||||
|
extensions = ['.el']
|
||||||
tabbercls = ELispTabber
|
tabbercls = ELispTabber
|
||||||
grammar = ELispGrammar
|
grammar = ELispGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'keyword': ('cyan', 'default'),
|
'keyword': ('cyan', 'default'),
|
||||||
'reserved': ('blue', 'default'),
|
'reserved': ('blue', 'default'),
|
||||||
'symbol': ('magenta', 'default'),
|
'symbol': ('magenta', 'default'),
|
||||||
|
@ -59,5 +62,3 @@ class ELisp(mode2.Fundamental):
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
## add lisp-specific methods
|
## add lisp-specific methods
|
||||||
#self.add_action_and_bindings(LispCheckSyntax(), ('C-c s',))
|
#self.add_action_and_bindings(LispCheckSyntax(), ('C-c s',))
|
||||||
def name(self):
|
|
||||||
return "ELisp"
|
|
||||||
|
|
|
@ -11,8 +11,9 @@ class HexGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Hex(mode2.Fundamental):
|
class Hex(mode2.Fundamental):
|
||||||
grammar = HexGrammar
|
modename = 'Hex'
|
||||||
colors = {
|
grammar = HexGrammar
|
||||||
|
colors = {
|
||||||
'zero': ('magenta', 'default'),
|
'zero': ('magenta', 'default'),
|
||||||
'byte': ('white', 'default'),
|
'byte': ('white', 'default'),
|
||||||
}
|
}
|
||||||
|
@ -30,9 +31,6 @@ class Hex(mode2.Fundamental):
|
||||||
else:
|
else:
|
||||||
self.del_binding(c)
|
self.del_binding(c)
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return "Hex"
|
|
||||||
|
|
||||||
class GotoWord(Method):
|
class GotoWord(Method):
|
||||||
'''Jump to the specified line number'''
|
'''Jump to the specified line number'''
|
||||||
args = [Argument("wordno", type=type(0), prompt="Goto word: ")]
|
args = [Argument("wordno", type=type(0), prompt="Goto word: ")]
|
||||||
|
|
13
mode/html.py
13
mode/html.py
|
@ -15,8 +15,10 @@ class HTMLGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class HTML(mode2.Fundamental):
|
class HTML(mode2.Fundamental):
|
||||||
grammar = HTMLGrammar
|
modename = 'HTML'
|
||||||
colors = {
|
extensions = ['.html', '.htm', '.shtml', '.shtm', '.xhtml']
|
||||||
|
grammar = HTMLGrammar
|
||||||
|
colors = {
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
'comment.end': ('red', 'default'),
|
'comment.end': ('red', 'default'),
|
||||||
|
@ -39,14 +41,9 @@ class HTML(mode2.Fundamental):
|
||||||
'tag.string.end': ('green', 'default'),
|
'tag.string.end': ('green', 'default'),
|
||||||
'tag.end': ('default', 'default'),
|
'tag.end': ('default', 'default'),
|
||||||
}
|
}
|
||||||
js = Javascript(None)
|
colors.update(Javascript.colors)
|
||||||
for name in js.colors:
|
|
||||||
colors['script.%s' % name] = js.colors[name]
|
|
||||||
del js
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "HTML"
|
|
||||||
|
|
14
mode/java.py
14
mode/java.py
|
@ -154,13 +154,15 @@ class JavaTabber(CTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Java(mode2.Fundamental):
|
class Java(mode2.Fundamental):
|
||||||
tabbercls = JavaTabber
|
modename = 'Java'
|
||||||
grammar = JavaGrammar
|
extensions = ['.java']
|
||||||
|
tabbercls = JavaTabber
|
||||||
|
grammar = JavaGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.end': ('red', 'default'),
|
'comment.end': ('red', 'default'),
|
||||||
|
@ -190,5 +192,3 @@ class Java(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Java"
|
|
||||||
|
|
|
@ -53,13 +53,15 @@ class JavascriptTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Javascript(mode2.Fundamental):
|
class Javascript(mode2.Fundamental):
|
||||||
|
modename = 'Javascript'
|
||||||
|
extensions = ['.js']
|
||||||
grammar = JavascriptGrammar
|
grammar = JavascriptGrammar
|
||||||
tabbercls = JavascriptTabber
|
tabbercls = JavascriptTabber
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
|
@ -93,5 +95,3 @@ class Javascript(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Javascript"
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ class LispTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Lisp(mode2.Fundamental):
|
class Lisp(mode2.Fundamental):
|
||||||
|
modename = 'Lisp'
|
||||||
tabwidth = 2
|
tabwidth = 2
|
||||||
tabbercls = LispTabber
|
tabbercls = LispTabber
|
||||||
grammar = LispGrammar
|
grammar = LispGrammar
|
||||||
|
@ -51,5 +52,3 @@ class Lisp(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Lisp"
|
|
||||||
|
|
10
mode/make.py
10
mode/make.py
|
@ -28,9 +28,11 @@ class MakeGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Make(mode2.Fundamental):
|
class Make(mode2.Fundamental):
|
||||||
grammar = MakeGrammar
|
modename = 'Make'
|
||||||
savetabs = True
|
basenames = ['Makefile']
|
||||||
colors = {
|
grammar = MakeGrammar
|
||||||
|
savetabs = True
|
||||||
|
colors = {
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'continuation': ('red', 'default'),
|
'continuation': ('red', 'default'),
|
||||||
|
|
||||||
|
@ -48,5 +50,3 @@ class Make(mode2.Fundamental):
|
||||||
'string.end': ('green', 'default'),
|
'string.end': ('green', 'default'),
|
||||||
}
|
}
|
||||||
colors.update(Sh.colors)
|
colors.update(Sh.colors)
|
||||||
def name(self):
|
|
||||||
return "Make"
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import method, mode2
|
import method, mode2
|
||||||
|
|
||||||
class Mini(mode2.Fundamental):
|
class Mini(mode2.Fundamental):
|
||||||
'''This is the default mode'''
|
modename = 'Mini'
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
|
|
||||||
|
@ -18,10 +18,6 @@ class Mini(mode2.Fundamental):
|
||||||
# add some new actions for the minibuffer
|
# add some new actions for the minibuffer
|
||||||
self.add_action_and_bindings(MiniCallback(), ('RETURN',))
|
self.add_action_and_bindings(MiniCallback(), ('RETURN',))
|
||||||
self.add_action_and_bindings(MiniTabComplete(), ('TAB',))
|
self.add_action_and_bindings(MiniTabComplete(), ('TAB',))
|
||||||
#self.add_action_and_bindings(MiniCancel(), ('C-]',))
|
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return "Mini"
|
|
||||||
|
|
||||||
class MiniCallback(method.Method):
|
class MiniCallback(method.Method):
|
||||||
def execute(self, window, **vargs):
|
def execute(self, window, **vargs):
|
||||||
|
|
|
@ -18,8 +18,9 @@ class MuttGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Mutt(mode2.Fundamental):
|
class Mutt(mode2.Fundamental):
|
||||||
grammar = MuttGrammar()
|
modename = 'Mutt'
|
||||||
colors = {
|
grammar = MuttGrammar()
|
||||||
|
colors = {
|
||||||
'header': ('green', 'default', 'bold'),
|
'header': ('green', 'default', 'bold'),
|
||||||
'email': ('cyan', 'default', 'bold'),
|
'email': ('cyan', 'default', 'bold'),
|
||||||
'url': ('cyan', 'default', 'bold'),
|
'url': ('cyan', 'default', 'bold'),
|
||||||
|
@ -38,8 +39,6 @@ class Mutt(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(mode.text.LearnWord(), ('C-c l',))
|
self.add_action_and_bindings(mode.text.LearnWord(), ('C-c l',))
|
||||||
self.add_action_and_bindings(MuttWrapParagraph(), ('M-q',))
|
self.add_action_and_bindings(MuttWrapParagraph(), ('M-q',))
|
||||||
self.add_action_and_bindings(MuttInsertSpace(), ('SPACE',))
|
self.add_action_and_bindings(MuttInsertSpace(), ('SPACE',))
|
||||||
def name(self):
|
|
||||||
return "Mutt"
|
|
||||||
|
|
||||||
class MuttWrapLine(method.WrapLine):
|
class MuttWrapLine(method.WrapLine):
|
||||||
limit = 72
|
limit = 72
|
||||||
|
|
10
mode/nasm.py
10
mode/nasm.py
|
@ -27,8 +27,10 @@ class NasmGrammar(Grammar):
|
||||||
|
|
||||||
|
|
||||||
class Nasm(mode2.Fundamental):
|
class Nasm(mode2.Fundamental):
|
||||||
grammar = NasmGrammar
|
modename = 'nasm'
|
||||||
colors = {
|
extensions = ['.s']
|
||||||
|
grammar = NasmGrammar
|
||||||
|
colors = {
|
||||||
'keyword': ('cyan', 'default', 'bold'),
|
'keyword': ('cyan', 'default', 'bold'),
|
||||||
'macros': ('blue', 'default', 'bold'),
|
'macros': ('blue', 'default', 'bold'),
|
||||||
'string.start': ('green', 'default'),
|
'string.start': ('green', 'default'),
|
||||||
|
@ -39,7 +41,3 @@ class Nasm(mode2.Fundamental):
|
||||||
'instructions': ('magenta', 'default'),
|
'instructions': ('magenta', 'default'),
|
||||||
'label': ('blue', 'default'),
|
'label': ('blue', 'default'),
|
||||||
}
|
}
|
||||||
def __init__(self, w):
|
|
||||||
mode2.Fundamental.__init__(self, w)
|
|
||||||
def name(self):
|
|
||||||
return "Nasm"
|
|
||||||
|
|
|
@ -55,12 +55,14 @@ class OcamlGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Ocaml(mode2.Fundamental):
|
class Ocaml(mode2.Fundamental):
|
||||||
|
modename = 'ocaml'
|
||||||
|
extensions = ['.mli', '.ml']
|
||||||
grammar = OcamlGrammar
|
grammar = OcamlGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')'}
|
opentags = {'(': ')'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '('}
|
closetags = {')': '('}
|
||||||
colors = {
|
colors = {
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
'comment.end': ('red', 'default'),
|
'comment.end': ('red', 'default'),
|
||||||
|
@ -90,5 +92,3 @@ class Ocaml(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Ocaml"
|
|
||||||
|
|
|
@ -195,13 +195,16 @@ class PerlTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Perl(mode2.Fundamental):
|
class Perl(mode2.Fundamental):
|
||||||
|
modename = 'Perl'
|
||||||
|
extensions = ['.pl', '.pm']
|
||||||
|
detection = ['perl']
|
||||||
tabbercls = PerlTabber
|
tabbercls = PerlTabber
|
||||||
grammar = PerlGrammar
|
grammar = PerlGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
# comments
|
# comments
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'endblock.start': ('red', 'default'),
|
'endblock.start': ('red', 'default'),
|
||||||
|
@ -297,7 +300,6 @@ class Perl(mode2.Fundamental):
|
||||||
'translate.end': ('magenta', 'default'),
|
'translate.end': ('magenta', 'default'),
|
||||||
'translate.null': ('magenta', 'default'),
|
'translate.null': ('magenta', 'default'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
|
|
||||||
|
@ -321,9 +323,6 @@ class Perl(mode2.Fundamental):
|
||||||
self.functions = None
|
self.functions = None
|
||||||
self.perllib = 'lib'
|
self.perllib = 'lib'
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return "Perl"
|
|
||||||
|
|
||||||
def build_function_map(self):
|
def build_function_map(self):
|
||||||
b = self.window.buffer
|
b = self.window.buffer
|
||||||
self.functions = {}
|
self.functions = {}
|
||||||
|
|
|
@ -10,6 +10,7 @@ class StringGrammar(Grammar):
|
||||||
]
|
]
|
||||||
class RawStringGrammar(Grammar):
|
class RawStringGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
|
PatternRule(r'escaped', r'\\\\'),
|
||||||
PatternRule(r'escaped', r"\\'"),
|
PatternRule(r'escaped', r"\\'"),
|
||||||
PatternRule(r'escaped', r'\\"'),
|
PatternRule(r'escaped', r'\\"'),
|
||||||
]
|
]
|
||||||
|
@ -176,13 +177,16 @@ class PythonTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Python(mode2.Fundamental):
|
class Python(mode2.Fundamental):
|
||||||
|
modename = 'Python'
|
||||||
|
extensions = ['.py']
|
||||||
|
detection = ['python']
|
||||||
tabbercls = PythonTabber
|
tabbercls = PythonTabber
|
||||||
grammar = PythonGrammar
|
grammar = PythonGrammar
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'keyword': ('cyan', 'default'),
|
'keyword': ('cyan', 'default'),
|
||||||
'reserved': ('magenta', 'default'),
|
'reserved': ('magenta', 'default'),
|
||||||
'builtin': ('cyan', 'default'),
|
'builtin': ('cyan', 'default'),
|
||||||
|
@ -215,8 +219,6 @@ class Python(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(PythonDictCleanup(), ('C-c h',))
|
self.add_action_and_bindings(PythonDictCleanup(), ('C-c h',))
|
||||||
# highlighting
|
# highlighting
|
||||||
self.pythonlib = "."
|
self.pythonlib = "."
|
||||||
def name(self):
|
|
||||||
return "Python"
|
|
||||||
|
|
||||||
class PythonSetLib(method.Method):
|
class PythonSetLib(method.Method):
|
||||||
'''Set the path(s) to find perl modules'''
|
'''Set the path(s) to find perl modules'''
|
||||||
|
|
|
@ -4,7 +4,7 @@ import color, method, minibuffer, mode2, searchutil
|
||||||
from point2 import Point
|
from point2 import Point
|
||||||
|
|
||||||
class Replace(mode2.Fundamental):
|
class Replace(mode2.Fundamental):
|
||||||
'''This is the default mode'''
|
modename = 'Replace'
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ class Replace(mode2.Fundamental):
|
||||||
w.set_error('%r was not found' % m.before)
|
w.set_error('%r was not found' % m.before)
|
||||||
raise minibuffer.MiniBufferError
|
raise minibuffer.MiniBufferError
|
||||||
_set_prompt(m)
|
_set_prompt(m)
|
||||||
def name(self):
|
|
||||||
return "Replace"
|
|
||||||
|
|
||||||
class ReplaceOne(method.Method):
|
class ReplaceOne(method.Method):
|
||||||
def execute(self, w, **vargs):
|
def execute(self, w, **vargs):
|
||||||
|
|
|
@ -41,8 +41,10 @@ class RSTGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class RST(mode2.Fundamental):
|
class RST(mode2.Fundamental):
|
||||||
grammar = RSTGrammar
|
modename = 'RST'
|
||||||
colors = {
|
extensions = ['.rst']
|
||||||
|
grammar = RSTGrammar
|
||||||
|
colors = {
|
||||||
'title': ('blue', 'default'),
|
'title': ('blue', 'default'),
|
||||||
'title_over': ('blue', 'default'),
|
'title_over': ('blue', 'default'),
|
||||||
'title_under': ('blue', 'default'),
|
'title_under': ('blue', 'default'),
|
||||||
|
@ -73,5 +75,3 @@ class RST(mode2.Fundamental):
|
||||||
'bullet': ('magenta', 'default'),
|
'bullet': ('magenta', 'default'),
|
||||||
'enumeration': ('magenta', 'default'),
|
'enumeration': ('magenta', 'default'),
|
||||||
}
|
}
|
||||||
def name(self):
|
|
||||||
return "RST"
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ class SchemeGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Scheme(mode2.Fundamental):
|
class Scheme(mode2.Fundamental):
|
||||||
|
modename = 'Scheme'
|
||||||
|
extensions = ['.scm']
|
||||||
tabwidth = 2
|
tabwidth = 2
|
||||||
tabbercls = mode.lisp.LispTabber
|
tabbercls = mode.lisp.LispTabber
|
||||||
grammar = SchemeGrammar
|
grammar = SchemeGrammar
|
||||||
|
@ -50,11 +52,6 @@ class Scheme(mode2.Fundamental):
|
||||||
}
|
}
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
# tag matching
|
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
## add scheme-specific methods
|
|
||||||
#self.add_action_and_bindings(SchemeCheckSyntax(), ('C-c s',))
|
|
||||||
def name(self):
|
|
||||||
return "Scheme"
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ selected_color = 'magenta'
|
||||||
unselected_color = 'yellow'
|
unselected_color = 'yellow'
|
||||||
|
|
||||||
class Search(mode2.Fundamental):
|
class Search(mode2.Fundamental):
|
||||||
'''This is the default mode'''
|
modename = 'Search'
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@ class Search(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(InsertSearchString(c), (c,))
|
self.add_action_and_bindings(InsertSearchString(c), (c,))
|
||||||
self.add_action_and_bindings(InsertSearchString(' '), ('SPACE',))
|
self.add_action_and_bindings(InsertSearchString(' '), ('SPACE',))
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return "Search"
|
|
||||||
|
|
||||||
def _make_regex(w, s):
|
def _make_regex(w, s):
|
||||||
try:
|
try:
|
||||||
if w.buffer.method.is_literal:
|
if w.buffer.method.is_literal:
|
||||||
|
|
14
mode/sh.py
14
mode/sh.py
|
@ -23,7 +23,6 @@ class EvalGrammar(Grammar):
|
||||||
|
|
||||||
class CaseGrammar(Grammar):
|
class CaseGrammar(Grammar):
|
||||||
rules = [
|
rules = [
|
||||||
#RegionRule(r'stanza', r'.+\)', Grammar, r';;'),
|
|
||||||
RegionRule(r'stanza', r'.+\)', Grammar, r';;'),
|
RegionRule(r'stanza', r'.+\)', Grammar, r';;'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -71,8 +70,9 @@ class ShGrammar(Grammar):
|
||||||
PatternRule(r'eol', r'\n$'),
|
PatternRule(r'eol', r'\n$'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# hack to get some circular grammar refs
|
# hacks to get some circular grammar refs
|
||||||
CaseGrammar.rules[0].pairs[0] = (ShGrammar, CaseGrammar.rules[0].pairs[0][1])
|
CaseGrammar.rules[0].pairs[0] = (ShGrammar, CaseGrammar.rules[0].pairs[0][1])
|
||||||
|
#ShGrammar.rules[2].pairs[0] = (ShGrammar, ShGrammar.rules[0].pairs[0][1])
|
||||||
|
|
||||||
class ShTabber(tab2.StackTabber):
|
class ShTabber(tab2.StackTabber):
|
||||||
def is_base(self, y):
|
def is_base(self, y):
|
||||||
|
@ -102,12 +102,16 @@ class ShTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Sh(mode2.Fundamental):
|
class Sh(mode2.Fundamental):
|
||||||
|
modename = 'sh'
|
||||||
|
paths = ['/etc/profile']
|
||||||
|
basenames = ['.bashrc', '.bash_profile', '.profile']
|
||||||
|
extensions = ['.bash', '.sh']
|
||||||
|
detection = ['sh', 'bash']
|
||||||
grammar = ShGrammar
|
grammar = ShGrammar
|
||||||
tabbercls = ShTabber
|
tabbercls = ShTabber
|
||||||
opentokens = ('delimiter', 'reserved', 'case.start')
|
opentokens = ('delimiter', 'reserved', 'case.start')
|
||||||
opentags = {'(': ')', '[': ']', '{': '}',
|
opentags = {'(': ')', '[': ']', '{': '}', 'do': 'done', 'then': 'fi', 'case': 'esac'}
|
||||||
'do': 'done', 'then': 'fi', 'case': 'esac'}
|
closetokens = ('delimiter', 'reserved', 'case.end')
|
||||||
closetokens = ('delimiter', 'reserved', 'case.end')
|
|
||||||
closetags = {')': '(', ']': '[', '}': '{',
|
closetags = {')': '(', ']': '[', '}': '{',
|
||||||
'done': 'do', 'fi': 'then', 'esac': 'case'}
|
'done': 'do', 'fi': 'then', 'esac': 'case'}
|
||||||
colors = {
|
colors = {
|
||||||
|
|
|
@ -93,13 +93,15 @@ class SqlTabber(tab2.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Sql(mode2.Fundamental):
|
class Sql(mode2.Fundamental):
|
||||||
|
modename = 'Sql'
|
||||||
|
extensions = ['.sql']
|
||||||
grammar = SqlGrammar
|
grammar = SqlGrammar
|
||||||
tabbercls = SqlTabber
|
tabbercls = SqlTabber
|
||||||
opentokens = ('delimiter',)
|
opentokens = ('delimiter',)
|
||||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||||
closetokens = ('delimiter',)
|
closetokens = ('delimiter',)
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
'comment': ('red', 'default'),
|
'comment': ('red', 'default'),
|
||||||
'operator': ('yellow', 'default'),
|
'operator': ('yellow', 'default'),
|
||||||
'attribute': ('magenta', 'default'),
|
'attribute': ('magenta', 'default'),
|
||||||
|
@ -126,11 +128,8 @@ class Sql(mode2.Fundamental):
|
||||||
'function.definition.null': ('magenta', 'default'),
|
'function.definition.null': ('magenta', 'default'),
|
||||||
'function.definition.end': ('magenta', 'default'),
|
'function.definition.end': ('magenta', 'default'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Sql"
|
|
||||||
|
|
|
@ -35,8 +35,10 @@ class TextGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Text(mode2.Fundamental):
|
class Text(mode2.Fundamental):
|
||||||
grammar = TextGrammar
|
modename = 'Text'
|
||||||
colors = {
|
extensions=['.txt']
|
||||||
|
grammar = TextGrammar
|
||||||
|
colors = {
|
||||||
'misspelled': ('red', 'default'),
|
'misspelled': ('red', 'default'),
|
||||||
'cont.start': ('default', 'default'),
|
'cont.start': ('default', 'default'),
|
||||||
'cont.end': ('default', 'default'),
|
'cont.end': ('default', 'default'),
|
||||||
|
@ -49,8 +51,6 @@ class Text(mode2.Fundamental):
|
||||||
self.add_action_and_bindings(LearnWord(), ('C-c l',))
|
self.add_action_and_bindings(LearnWord(), ('C-c l',))
|
||||||
self.add_action_and_bindings(TextInsertSpace(), ('SPACE',))
|
self.add_action_and_bindings(TextInsertSpace(), ('SPACE',))
|
||||||
self.add_action_and_bindings(method.WrapParagraph(), ('M-q',))
|
self.add_action_and_bindings(method.WrapParagraph(), ('M-q',))
|
||||||
def name(self):
|
|
||||||
return "Text"
|
|
||||||
|
|
||||||
class TextInsertSpace(method.Method):
|
class TextInsertSpace(method.Method):
|
||||||
limit = 80
|
limit = 80
|
||||||
|
|
|
@ -13,8 +13,10 @@ class Text2Grammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Text2(mode.text.Text):
|
class Text2(mode.text.Text):
|
||||||
grammar = Text2Grammar
|
modename = 'Text2'
|
||||||
colors = {
|
grammar = Text2Grammar
|
||||||
|
extensions = ['.txt']
|
||||||
|
colors = {
|
||||||
'email': ('cyan', 'default'),
|
'email': ('cyan', 'default'),
|
||||||
'url': ('green', 'default'),
|
'url': ('green', 'default'),
|
||||||
'misspelled': ('red', 'default'),
|
'misspelled': ('red', 'default'),
|
||||||
|
@ -24,5 +26,3 @@ class Text2(mode.text.Text):
|
||||||
'punct': ('default', 'default'),
|
'punct': ('default', 'default'),
|
||||||
'stuff': ('default', 'default'),
|
'stuff': ('default', 'default'),
|
||||||
}
|
}
|
||||||
def name(self):
|
|
||||||
return "Text2"
|
|
||||||
|
|
|
@ -29,8 +29,10 @@ class TemplateGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class Template(mode2.Fundamental):
|
class Template(mode2.Fundamental):
|
||||||
grammar = TemplateGrammar
|
modename = 'Template'
|
||||||
colors = {
|
extensions = ['.tt']
|
||||||
|
grammar = TemplateGrammar
|
||||||
|
colors = {
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
'comment.end': ('red', 'default'),
|
'comment.end': ('red', 'default'),
|
||||||
|
@ -60,5 +62,3 @@ class Template(mode2.Fundamental):
|
||||||
self.add_bindings('close-paren', (')',))
|
self.add_bindings('close-paren', (')',))
|
||||||
self.add_bindings('close-brace', ('}',))
|
self.add_bindings('close-brace', ('}',))
|
||||||
self.add_bindings('close-bracket', (']',))
|
self.add_bindings('close-bracket', (']',))
|
||||||
def name(self):
|
|
||||||
return "Template"
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ import color, method, mode2
|
||||||
from point2 import Point
|
from point2 import Point
|
||||||
|
|
||||||
class Which(mode2.Fundamental):
|
class Which(mode2.Fundamental):
|
||||||
|
modename = 'Which'
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
mode2.Fundamental.__init__(self, w)
|
mode2.Fundamental.__init__(self, w)
|
||||||
old_mode = w.buffer.method.old_window.mode
|
old_mode = w.buffer.method.old_window.mode
|
||||||
|
@ -24,8 +25,6 @@ class Which(mode2.Fundamental):
|
||||||
err = "%s in mode '%s'" % (e, self.name())
|
err = "%s in mode '%s'" % (e, self.name())
|
||||||
self.window.application.set_error(err)
|
self.window.application.set_error(err)
|
||||||
self._end()
|
self._end()
|
||||||
def name(self):
|
|
||||||
return "Which"
|
|
||||||
def _end(self):
|
def _end(self):
|
||||||
self.window.application.close_mini_buffer()
|
self.window.application.close_mini_buffer()
|
||||||
self.window.buffer.method.old_cursor = None
|
self.window.buffer.method.old_cursor = None
|
||||||
|
|
|
@ -18,8 +18,10 @@ class XMLGrammar(Grammar):
|
||||||
]
|
]
|
||||||
|
|
||||||
class XML(mode2.Fundamental):
|
class XML(mode2.Fundamental):
|
||||||
grammar = XMLGrammar
|
modename = 'XML'
|
||||||
colors = {
|
extensions = ['.xml', '.xml.in']
|
||||||
|
grammar = XMLGrammar
|
||||||
|
colors = {
|
||||||
'comment.start': ('red', 'default'),
|
'comment.start': ('red', 'default'),
|
||||||
'comment.null': ('red', 'default'),
|
'comment.null': ('red', 'default'),
|
||||||
'comment.end': ('red', 'default'),
|
'comment.end': ('red', 'default'),
|
||||||
|
@ -32,5 +34,3 @@ class XML(mode2.Fundamental):
|
||||||
'tag.string.end': ('green', 'default'),
|
'tag.string.end': ('green', 'default'),
|
||||||
'tag.end': ('default', 'default'),
|
'tag.end': ('default', 'default'),
|
||||||
}
|
}
|
||||||
def name(self):
|
|
||||||
return "XML"
|
|
||||||
|
|
16
mode2.py
16
mode2.py
|
@ -32,6 +32,8 @@ class Handler(object):
|
||||||
def add_binding(self, name, sequence):
|
def add_binding(self, name, sequence):
|
||||||
if self.window is None:
|
if self.window is None:
|
||||||
return
|
return
|
||||||
|
elif not hasattr(self.window, 'application'):
|
||||||
|
raise Exception, "argh %r %r" % (self, self.window)
|
||||||
elif name not in self.window.application.methods:
|
elif name not in self.window.application.methods:
|
||||||
raise Exception, "No action called %r found" % name
|
raise Exception, "No action called %r found" % name
|
||||||
else:
|
else:
|
||||||
|
@ -72,6 +74,11 @@ class Handler(object):
|
||||||
|
|
||||||
class Fundamental(Handler):
|
class Fundamental(Handler):
|
||||||
'''This is the default mode'''
|
'''This is the default mode'''
|
||||||
|
modename = "Fundamental"
|
||||||
|
paths = []
|
||||||
|
basenames = []
|
||||||
|
extensions = []
|
||||||
|
detection = []
|
||||||
savetabs = False
|
savetabs = False
|
||||||
tabwidth = 4
|
tabwidth = 4
|
||||||
tabbercls = None
|
tabbercls = None
|
||||||
|
@ -80,6 +87,13 @@ class Fundamental(Handler):
|
||||||
tabber = None
|
tabber = None
|
||||||
default_color = ('default', 'default',)
|
default_color = ('default', 'default',)
|
||||||
colors = {}
|
colors = {}
|
||||||
|
|
||||||
|
def install(cls, app):
|
||||||
|
app.setmode(cls.modename.lower(), cls, paths=cls.paths,
|
||||||
|
basenames=cls.basenames, extensions=cls.extensions,
|
||||||
|
detection=cls.detection)
|
||||||
|
install = classmethod(install)
|
||||||
|
|
||||||
def __init__(self, w):
|
def __init__(self, w):
|
||||||
self.window = w
|
self.window = w
|
||||||
|
|
||||||
|
@ -185,7 +199,7 @@ class Fundamental(Handler):
|
||||||
|
|
||||||
# get mode name
|
# get mode name
|
||||||
def name(self):
|
def name(self):
|
||||||
return "Fundamental"
|
return self.modename
|
||||||
|
|
||||||
# handle input tokens
|
# handle input tokens
|
||||||
def handle_token(self, t):
|
def handle_token(self, t):
|
||||||
|
|
Loading…
Reference in New Issue