emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog dired.c


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/src ChangeLog dired.c
Date: Tue, 17 Mar 2009 19:05:42 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/03/17 19:05:42

Modified files:
        src            : ChangeLog dired.c 

Log message:
        (file_name_completion): Check completion-ignored-extensions
        only if the entry can't affect bestmatch anyway.
        Stop the search early, as Ftry_completion already does.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7432&r2=1.7433
http://cvs.savannah.gnu.org/viewcvs/emacs/src/dired.c?cvsroot=emacs&r1=1.158&r2=1.159

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7432
retrieving revision 1.7433
diff -u -b -r1.7432 -r1.7433
--- ChangeLog   17 Mar 2009 04:38:03 -0000      1.7432
+++ ChangeLog   17 Mar 2009 19:05:40 -0000      1.7433
@@ -1,3 +1,9 @@
+2009-03-17  Stefan Monnier  <address@hidden>
+
+       * dired.c (file_name_completion): Check completion-ignored-extensions
+       only if the entry can't affect bestmatch anyway.
+       Stop the search early, as Ftry_completion already does.
+
 2009-03-17  Chong Yidong  <address@hidden>
 
        * minibuf.c (Vminibuffer_completion_confirm): Doc fix.

Index: dired.c
===================================================================
RCS file: /sources/emacs/emacs/src/dired.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -b -r1.158 -r1.159
--- dired.c     8 Jan 2009 03:15:31 -0000       1.158
+++ dired.c     17 Mar 2009 19:05:42 -0000      1.159
@@ -537,6 +537,18 @@
       if (!all_flag)
        {
          int skip;
+
+         /* If this entry matches the current bestmatch, the only
+            thing it can do is increase matchcount, so don't bother
+            investigating it any further.  */
+         if (!completion_ignore_case
+             /* The return result depends on whether it's the sole match.  */
+             && matchcount > 1
+             && !includeall /* This match may allow includeall to 0.  */
+             && len >= bestmatchsize
+             && 0 > scmp (dp->d_name, SDATA (bestmatch), bestmatchsize))
+           continue;
+
          if (directoryp)
            {
 #ifndef TRIVIAL_DIRECTORY_ENTRY
@@ -705,8 +717,7 @@
              /* This tests that the current file is an exact match
                 but BESTMATCH is not (it is too long).  */
              if ((matchsize == SCHARS (name)
-                  && matchsize + !!directoryp
-                  < SCHARS (bestmatch))
+                  && matchsize + !!directoryp < SCHARS (bestmatch))
                  ||
                  /* If there is no exact match ignoring case,
                     prefer a match that does not change the case
@@ -734,6 +745,20 @@
                bestmatch = name;
            }
          bestmatchsize = matchsize;
+
+         /* If the best completion so far is reduced to the string
+            we're trying to complete, then we already know there's no
+            other completion, so there's no point looking any further.  */
+         if (matchsize <= SCHARS (file)
+             && !includeall /* A future match may allow includeall to 0.  */
+             /* If completion-ignore-case is non-nil, don't
+                short-circuit because we want to find the best
+                possible match *including* case differences.  */
+             && (!completion_ignore_case || matchsize == 0)
+             /* The return value depends on whether it's the sole match.  */
+             && matchcount > 1)
+           break;
+
        }
     }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]