Checked emerge-xtra.texi
[bpt/emacs.git] / lisp / icomplete.el
index 53876f4..a971965 100644 (file)
@@ -1,6 +1,6 @@
 ;;; icomplete.el --- minibuffer completion incremental feedback
 
-;; Copyright (C) 1992-1994, 1997, 1999, 2001-2011
+;; Copyright (C) 1992-1994, 1997, 1999, 2001-2012
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <klm@i.am>
@@ -347,7 +347,9 @@ are exhibited within the square braces.)"
            (setq prospects nil)
          (while (and comps (not limit))
            (setq comp
-                  (if prefix-len (substring (car comps) prefix-len) (car comps))
+                 (if (and prefix-len (<= prefix-len (length (car comps))))
+                     (substring (car comps) prefix-len)
+                   (car comps))
                  comps (cdr comps))
            (cond ((string-equal comp "") (setq most-is-exact t))
                  ((member comp prospects))