summaryrefslogtreecommitdiff
path: root/lisp/icomplete.el
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2012-02-20 16:06:52 +0800
committerLeo Liu <sdl.web@gmail.com>2012-02-20 16:06:52 +0800
commitab1ce9d7e2d5bda36e361583237e0b76a4a17298 (patch)
tree9677815d64a89d6a82a0fa17c3a4d27657c38096 /lisp/icomplete.el
parentb0668aa847fc5112debd686291aa457d252482e1 (diff)
downloademacs-ab1ce9d7e2d5bda36e361583237e0b76a4a17298.tar.gz
Check FROM arg to substring in icomplete-completions
See: http://debbugs.gnu.org/10850
Diffstat (limited to 'lisp/icomplete.el')
-rw-r--r--lisp/icomplete.el4
1 files changed, 3 insertions, 1 deletions
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))