aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog6
-rw-r--r--src/dired.c29
2 files changed, 33 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 77fd6cf0fd4..35c81a87ac9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12009-03-17 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * dired.c (file_name_completion): Check completion-ignored-extensions
4 only if the entry can't affect bestmatch anyway.
5 Stop the search early, as Ftry_completion already does.
6
12009-03-17 Chong Yidong <cyd@stupidchicken.com> 72009-03-17 Chong Yidong <cyd@stupidchicken.com>
2 8
3 * minibuf.c (Vminibuffer_completion_confirm): Doc fix. 9 * minibuf.c (Vminibuffer_completion_confirm): Doc fix.
diff --git a/src/dired.c b/src/dired.c
index 0779fcd3c89..b6bc7067736 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -537,6 +537,18 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
537 if (!all_flag) 537 if (!all_flag)
538 { 538 {
539 int skip; 539 int skip;
540
541 /* If this entry matches the current bestmatch, the only
542 thing it can do is increase matchcount, so don't bother
543 investigating it any further. */
544 if (!completion_ignore_case
545 /* The return result depends on whether it's the sole match. */
546 && matchcount > 1
547 && !includeall /* This match may allow includeall to 0. */
548 && len >= bestmatchsize
549 && 0 > scmp (dp->d_name, SDATA (bestmatch), bestmatchsize))
550 continue;
551
540 if (directoryp) 552 if (directoryp)
541 { 553 {
542#ifndef TRIVIAL_DIRECTORY_ENTRY 554#ifndef TRIVIAL_DIRECTORY_ENTRY
@@ -705,8 +717,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
705 /* This tests that the current file is an exact match 717 /* This tests that the current file is an exact match
706 but BESTMATCH is not (it is too long). */ 718 but BESTMATCH is not (it is too long). */
707 if ((matchsize == SCHARS (name) 719 if ((matchsize == SCHARS (name)
708 && matchsize + !!directoryp 720 && matchsize + !!directoryp < SCHARS (bestmatch))
709 < SCHARS (bestmatch))
710 || 721 ||
711 /* If there is no exact match ignoring case, 722 /* If there is no exact match ignoring case,
712 prefer a match that does not change the case 723 prefer a match that does not change the case
@@ -734,6 +745,20 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
734 bestmatch = name; 745 bestmatch = name;
735 } 746 }
736 bestmatchsize = matchsize; 747 bestmatchsize = matchsize;
748
749 /* If the best completion so far is reduced to the string
750 we're trying to complete, then we already know there's no
751 other completion, so there's no point looking any further. */
752 if (matchsize <= SCHARS (file)
753 && !includeall /* A future match may allow includeall to 0. */
754 /* If completion-ignore-case is non-nil, don't
755 short-circuit because we want to find the best
756 possible match *including* case differences. */
757 && (!completion_ignore_case || matchsize == 0)
758 /* The return value depends on whether it's the sole match. */
759 && matchcount > 1)
760 break;
761
737 } 762 }
738 } 763 }
739 764