From 1a2a5a86f6f0a123e831d5034cc5f64b2191eb61 Mon Sep 17 00:00:00 2001 From: William Ting Date: Tue, 17 Dec 2013 11:01:18 -0600 Subject: [PATCH] move existence of directories checking to end --- bin/autojump | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/autojump b/bin/autojump index ff3c2bc..3b0e076 100755 --- a/bin/autojump +++ b/bin/autojump @@ -193,9 +193,8 @@ def decrease_path(config, path, increment=15): def find_matches(config, needles, count=1): """Return [count] paths matching needles.""" entriefy = lambda tup: Entry(*tup) - exists = lambda entry: os.path.exists(entry.path) data = sorted( - ifilter(exists, imap(entriefy, load(config).iteritems())), + imap(entriefy, load(config).iteritems()), key=attrgetter('weight'), reverse=True) @@ -212,7 +211,8 @@ def find_matches(config, needles, count=1): else: exact_matches = match_regex(needles, data, ignore_case) - return first(exact_matches).path + exists = lambda entry: os.path.exists(entry.path) + return first(ifilter(exists, exact_matches)).path def match_end(needle, haystack, ignore_case=False):