diff --git a/BUGS b/BUGS index 29e77aa..b1a0be1 100644 --- a/BUGS +++ b/BUGS @@ -1,5 +1,13 @@ === OUSTANDING BUGS === +2009/06/09: + 1. many of the dir-mode methods need better names, to make it clear they + aren't general purpose. + + 2. need a "refresh-screen" command. + + 3. headers work poorly with some indenting schemes. + 2009/06/04: change the mode-detection order--using the "in-file" override should be able to override a positive match on file extension, filename, etc. diff --git a/application.py b/application.py index 6da4890..7282692 100755 --- a/application.py +++ b/application.py @@ -197,7 +197,8 @@ class Application(object): curses.def_prog_mode() def _load_config_defaults(self): - self.config['ignore_suffix'] = ['~', '-'] + self.config['ignore_suffix'] = ['~', '-', 'CVS', '.svn', '.git', '.hg'] + self.config['error_timeout'] = -1 self.config['max_error_len'] = 192 self.config['max_num_kills'] = 64 diff --git a/mode/dir.py b/mode/dir.py index 86a292b..a4d2def 100644 --- a/mode/dir.py +++ b/mode/dir.py @@ -1,4 +1,5 @@ import commands, dirutil, grp, method, mode, os.path, pwd, re +import util import buffer, buffer.fs from window import Window from lex import Grammar, PatternRule, RegionRule, PatternMatchRule @@ -72,9 +73,16 @@ class OpenPath(Method): class DirGrep(Method): args = [Argument('pattern', datatype="str", prompt="Pattern: ")] def _execute(self, w, **vargs): - cmd = 'grep -rEl %r %r' % (vargs['pattern'], w.buffer.path) + cmd = 'grep -rEl "%s" %r' % (vargs['pattern'], w.buffer.path) (status, output) = commands.getstatusoutput(cmd) - paths = [x for x in output.split('\n') if x] + + paths = [] + suffixes = w.application.config['ignore_suffix'] + for path in output.split('\n'): + if not path or util.should_ignore_path(path, suffixes): + continue + paths.append(path) + bufname = '*%s*' % self.name.title() b = buffer.fs.PathListBuffer(bufname, paths) b.modename = 'dir' diff --git a/util.py b/util.py index f3d135f..3a8458b 100644 --- a/util.py +++ b/util.py @@ -14,6 +14,13 @@ def flatzip(a, b): l.append(y) return l +def should_ignore_path(path, suffixes): + for name in path.split('/'): + for suffix in suffixes: + if name.endswith(suffix): + return True + return False + def normal_path(path): #path = os.path.realpath(path) path = os.path.normpath(path)