summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorTomoki Sekiyama <tomoki.sekiyama@gmail.com>2014-04-28 10:11:33 -0400
committerPeter Stephenson <pws@zsh.org>2014-04-29 10:44:09 +0100
commit0da28f323d790a79d965d9cec48604c97e03f4b8 (patch)
treefd38cf067b741d0c290c57048e84cb10454851d4 /Src/utils.c
parent9cd7ffe529981d9c1520a323b542a41eedbddc14 (diff)
downloadzsh-0da28f323d790a79d965d9cec48604c97e03f4b8.tar.gz
zsh-0da28f323d790a79d965d9cec48604c97e03f4b8.tar.xz
zsh-0da28f323d790a79d965d9cec48604c97e03f4b8.zip
32592: add CORRECT_IGNORE_FILE variable
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Src/utils.c b/Src/utils.c
index e1fd7a35b..943922725 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2491,7 +2491,7 @@ getquery(char *valid_chars, int purge)
 
 static int d;
 static char *guess, *best;
-static Patprog spckpat;
+static Patprog spckpat, spnamepat;
 
 /**/
 static void
@@ -2562,6 +2562,13 @@ spckword(char **s, int hist, int cmd, int ask)
     } else
 	spckpat = NULL;
 
+    if ((correct_ignore = getsparam("CORRECT_IGNORE_FILE")) != NULL) {
+	tokenize(correct_ignore = dupstring(correct_ignore));
+	remnulargs(correct_ignore);
+	spnamepat = patcompile(correct_ignore, 0, NULL);
+    } else
+	spnamepat = NULL;
+
     if (**s == String && !*t) {
 	guess = *s + 1;
 	if (itype_end(guess, IIDENT, 1) == guess)
@@ -3783,6 +3790,8 @@ mindist(char *dir, char *mindistguess, char *mindistbest)
     if (!(dd = opendir(unmeta(dir))))
 	return mindistd;
     while ((fn = zreaddir(dd, 0))) {
+	if (spnamepat && pattry(spnamepat, fn))
+	    continue;
 	nd = spdist(fn, mindistguess,
 		    (int)strlen(mindistguess) / 4 + 1);
 	if (nd <= mindistd) {