From: Leo Liu Date: Mon, 20 Feb 2012 08:06:52 +0000 (+0800) Subject: Check FROM arg to substring in icomplete-completions X-Git-Tag: emacs-pretest-24.0.94~99 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ab1ce9d7e2d5bda36e361583237e0b76a4a17298;p=emacs.git Check FROM arg to substring in icomplete-completions See: http://debbugs.gnu.org/10850 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cc5851373b0..629b5b19d93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-02-20 Leo Liu + + * icomplete.el (icomplete-completions): Check FROM arg before + passing to substring (Bug#10850). + 2012-02-19 Chong Yidong * comint.el: Require ansi-color. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 80a0bf1435b..a9719651957 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -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))