# HG changeset patch # User Stefan Monnier # Date 1259696392 0 # Node ID fceba9857bee48d096940de4914e7a20b062ed49 # Parent 8acd940e483a9d77d210defe41e9a009883780e5 (pcomplete-std-complete): Don't try to complete past the last element. diff -r 8acd940e483a -r fceba9857bee lisp/ChangeLog --- a/lisp/ChangeLog Tue Dec 01 19:01:41 2009 +0000 +++ b/lisp/ChangeLog Tue Dec 01 19:39:52 2009 +0000 @@ -1,5 +1,8 @@ 2009-12-01 Stefan Monnier + * pcomplete.el (pcomplete-std-complete): Don't try to complete past + the last element. + * simple.el (normal-erase-is-backspace-mode): Fix thinko in message. 2009-12-01 Glenn Morris diff -r 8acd940e483a -r fceba9857bee lisp/pcomplete.el --- a/lisp/pcomplete.el Tue Dec 01 19:01:41 2009 +0000 +++ b/lisp/pcomplete.el Tue Dec 01 19:39:52 2009 +0000 @@ -480,28 +480,31 @@ (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