* lisp/pcomplete.el: Convert to lexical binding and fix bug#8819.
(pcomplete-suffix-list): Mark as obsolete.
(pcomplete-completions-at-point): Capture pcomplete-norm-func and
pcomplete-seen in the closure.
(pcomplete-comint-setup): Setup completion-at-point as well.
(pcomplete--entries): New function.
(pcomplete--env-regexp): New var.
(pcomplete-entries): Rewrite to work with partial-completion and
without relying on pcomplete-suffix-list.
(pcomplete-pare-list): Remove, unused.
* lisp/shell.el (shell-completion-vars): Set pcomplete-termination-string
according to comint-completion-addsuffix.