From fa5f7908d459bca163cecbe68a1c74083813bdfa Mon Sep 17 00:00:00 2001 From: moculus Date: Mon, 4 May 2009 03:51:52 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- buffer/fs.py | 3 ++- mode/dir.py | 2 -- mode/python.py | 62 ++++++++++++++++++++++++++++---------------------- 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/buffer/fs.py b/buffer/fs.py index 173d564..5f0c8a9 100644 --- a/buffer/fs.py +++ b/buffer/fs.py @@ -6,7 +6,6 @@ class DirBuffer(Buffer): def __init__(self, path, name=None): Buffer.__init__(self) self.path = os.path.realpath(path) - self.settings['hide-dot'] = True self.settings['type-sort'] = False def changed(self): @@ -74,6 +73,8 @@ class PathListBuffer(DirBuffer): self.paths = list(paths) self.path = os.getcwd() self._name = name + self.settings['hide-dot'] = False + self.settings['type-sort'] = False def path_exists(self): raise Exception def _get_names(self): diff --git a/mode/dir.py b/mode/dir.py index d7abc37..86a292b 100644 --- a/mode/dir.py +++ b/mode/dir.py @@ -94,7 +94,6 @@ class DirCmd(Method): (status, output) = commands.getstatusoutput(cmd) if status != 0: w.set_error("%s failed (exit %d)" % (self.name, status)) - #w.application.methods['refresh-view'].execute(w, filename=path) dirutil.find_name(w, basename) class Chmod(DirCmd): @@ -111,7 +110,6 @@ class Chmod(DirCmd): else: w.set_error("Not a valid mode: %r" % vargs['mode']) self._run(w, **vargs) - class Chown(DirCmd): args = [Argument('owner', type=type(''), prompt="New Owner: ")] def _make_cmd(self, w, path, **vargs): diff --git a/mode/python.py b/mode/python.py index ef76b05..68b9526 100644 --- a/mode/python.py +++ b/mode/python.py @@ -39,16 +39,18 @@ class StringGrammar4(Grammar): class PythonGrammar(Grammar): rules = [ - PatternRule('functionname', '(?<=def )[a-zA-Z_][a-zA-Z0-9_]*'), - PatternRule('classname', '(?<=class )[a-zA-Z_][a-zA-Z0-9_]*'), + PatternRule('python.def', '(?<=def )[a-zA-Z_][a-zA-Z0-9_]*'), + PatternRule('python.class', '(?<=class )[a-zA-Z_][a-zA-Z0-9_]*'), PatternRule('python.reserved', '(?:True|None|False|Exception|self)(?![a-zA-Z0-9_])'), PatternRule('python.keyword', '(?:yield|with|while|try|return|raise|print|pass|or|not|lambda|is|in|import|if|global|from|for|finally|exec|except|else|elif|del|def|continue|class|break|assert|as|and)(?![a-zA-Z0-9_])'), PatternRule(r"python.builtin", r'(?>=|<<=|\*\*='), - PatternRule(r"integer", r"(?|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), + PatternRule(r"python.operator", r"\+|<>|<<|<=|<|-|>>|>=|>|\*\*|&|\*|\||/|\^|==|//|~|!=|%"), OverridePatternRule('comment', '#@@:(?P[.a-zA-Z0-9_]+):(?P[.a-zA-Z0-9_]+) *$'), PatternRule('comment', '#.*$'), @@ -439,11 +440,11 @@ class PythonContext(context.Context): class_match = And(Optional(Name('spaces')), Match('python.keyword', 'class'), Name('spaces'), - Name('classname')) + Name('python.class')) func_match = And(Optional(Name('spaces')), Match('python.keyword', 'def'), Name('spaces'), - Name('functionname')) + Name('python.def')) def __init__(self, mode): self.mode = mode self.names = None @@ -556,18 +557,26 @@ class Python(mode.Fundamental): closetags = {')': '(', ']': '[', '}': '{'} commentc = '#' colors = { - 'python.keyword': ('cyan', 'default', 'bold'), - 'python.reserved': ('magenta', 'default', 'bold'), - 'python.builtin': ('cyan', 'default', 'bold'), - 'functionname': ('blue', 'default', 'bold'), - #'classname': ('green', 'default', 'bold'), - 'classname': ('yellow', 'default', 'bold'), - 'rawstring.start': ('green', 'default', 'bold'), - 'rawstring.data': ('green', 'default', 'bold'), - 'rawstring.null': ('green', 'default', 'bold'), - 'rawstring.escaped': ('magenta', 'default', 'bold'), - 'rawstring.end': ('green', 'default', 'bold'), - 'system_identifier': ('cyan', 'default', 'bold'), + 'python.def': ('blue', 'default', 'bold'), + 'python.class': ('yellow', 'default', 'bold'), + 'python.reserved': ('magenta', 'default', 'bold'), + 'python.keyword': ('cyan', 'default', 'bold'), + 'python.builtin': ('cyan', 'default', 'bold'), + 'python.method': ('default', 'default'), + 'python.function': ('default', 'default'), + 'python.system_identifier': ('cyan', 'default', 'bold'), + 'python.private_identifier': ('default', 'default'), + 'python.hidden_identifier': ('default', 'default'), + 'python.identifier': ('default', 'default'), + 'python.integer': ('default', 'default'), + 'python.float': ('default', 'default'), + 'python.imaginary': ('default', 'default'), + 'python.operator': ('default', 'default'), + 'rawstring.start': ('green', 'default', 'bold'), + 'rawstring.data': ('green', 'default', 'bold'), + 'rawstring.null': ('green', 'default', 'bold'), + 'rawstring.escaped': ('magenta', 'default', 'bold'), + 'rawstring.end': ('green', 'default', 'bold'), } config = { 'python.lib': '.', @@ -586,7 +595,6 @@ class Python(mode.Fundamental): "pythonclass": PythonClassCompleter(None), } - #format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s] %(vc-info)s" format = "%(flag)s %(bname)s (%(mname)s) %(indent)s %(cursor)s %(perc)s [%(name)s] %(vc-info)s" header_size = 3