Subject: bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point

From: Clément Pit--Claudel <[email-masked]>
Date: Sat, 5 Nov 2016 19:53:34 -0400

pcomplete's ordering of completion makes it inconvenient to input directory names to 'cd' to when using company.  Example scenario:

* Start a shell (M-x shell)
* Enable company-mode
* Start typing `cd /home/clement/`

This invokes (assuming a low enough completion delay) pcomplete-at-point (the call goes through company-capf, which relies on completion-at-point-functions, which contains comint-dynamic-completion, which includes pcomplete-at-point).  The results of this pcomplete invocation include "../" and "./", followed by name-ordered file names.  There are two problems:

* "../" comes first, which causes the default completion to be "/home/clement/../".
* pcomplete's list doesn't include "/home/clement/" itself.

Fixing the second problem would fix the first one; if pcomplete included "" in its results in addition to "./" and "../", and ranked it first, there would be no problem (company would display "/home/clement/" first, just like company-files does)

Cheers,
Clément.

In GNU Emacs 26.0.50.14 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-10-29 built on clem-w50-mint
Repository revision: fae796fe2695b419aa9277d243633bae400a147a
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Linux Mint 18 Sarah