summaryrefslogtreecommitdiff
path: root/lisp/pcomplete.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-12-01 19:39:52 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-12-01 19:39:52 +0000
commita2877f1d6f917de6776849f35ed196f3b5615eb4 (patch)
tree8d8037a1c6d421437fe6668222276b52eb8bc25c /lisp/pcomplete.el
parent4e14547fd4bfc7aa52ceac3dbefa50fc7c1e04e8 (diff)
downloademacs-a2877f1d6f917de6776849f35ed196f3b5615eb4.tar.gz
(pcomplete-std-complete): Don't try to complete past the last element.
Diffstat (limited to 'lisp/pcomplete.el')
-rw-r--r--lisp/pcomplete.el31
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index a620880e0f7..d4258fe35f0 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -480,28 +480,31 @@ Same as `pcomplete' but using the standard completion UI."
(pcomplete-begin)))
(buftext (buffer-substring beg (point)))
(table
- (if (not (equal pcomplete-stub buftext))
- ;; This isn't always strictly right (e.g. if
- ;; FOO="toto/$FOO", then completion of /$FOO/bar may
- ;; result in something incorrect), but given the lack of
- ;; any other info, it's about as good as it gets, and in
- ;; practice it should work just fine (fingers crossed).
- (let ((prefixes (pcomplete--common-quoted-suffix
- pcomplete-stub buftext)))
- (apply-partially
- 'pcomplete--table-subvert
- completions
- (cdr prefixes) (car prefixes)))
+ (cond
+ ((null completions) nil)
+ ((not (equal pcomplete-stub buftext))
+ ;; This isn't always strictly right (e.g. if
+ ;; FOO="toto/$FOO", then completion of /$FOO/bar may
+ ;; result in something incorrect), but given the lack of
+ ;; any other info, it's about as good as it gets, and in
+ ;; practice it should work just fine (fingers crossed).
+ (let ((prefixes (pcomplete--common-quoted-suffix
+ pcomplete-stub buftext)))
+ (apply-partially
+ 'pcomplete--table-subvert
+ completions
+ (cdr prefixes) (car prefixes))))
+ (t
(lexical-let ((completions completions))
(lambda (string pred action)
(let ((res (complete-with-action
action completions string pred)))
(if (stringp res)
(pcomplete-quote-argument res)
- res))))))
+ res)))))))
(pred
;; pare it down, if applicable
- (when (and pcomplete-use-paring pcomplete-seen)
+ (when (and table pcomplete-use-paring pcomplete-seen)
(setq pcomplete-seen
(mapcar (lambda (f)
(funcall pcomplete-norm-func