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

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Sat, 5 Nov 2016 23:54:01 UTC

Severity: normal

To reply to this bug, email your comments to 24888 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24888; Package emacs. (Sat, 05 Nov 2016 23:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel <at> live.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 05 Nov 2016 23:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: pcomplete/cd returns "../" before "./" and does not include empty
 completion in results of pcomplete-at-point
Date: Sat, 5 Nov 2016 19:53:34 -0400
[Message part 1 (text/plain, inline)]
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
[pcomplete.png (image/png, attachment)]
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24888; Package emacs. (Mon, 07 Nov 2016 00:16:01 GMT) Full text and rfc822 format available.

Message #8 received at 24888 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>,
 24888 <at> debbugs.gnu.org
Subject: Re: bug#24888: pcomplete/cd returns "../" before "./" and does not
 include empty completion in results of pcomplete-at-point
Date: Mon, 7 Nov 2016 02:15:00 +0200
On 06.11.2016 01:53, Clément Pit--Claudel wrote:

> 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).

Does it? It seems to go through comint-completion-at-point here, which 
tries comint-c-a-p-replace-by-expanded-history and 
comint-filename-completion, neither of which reference pcomplete.

comint-filename-completion seems to be the function to investigate.

> * "../" 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;

Sounds good to me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24888; Package emacs. (Mon, 07 Nov 2016 01:06:02 GMT) Full text and rfc822 format available.

Message #11 received at 24888 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 24888 <at> debbugs.gnu.org
Subject: Re: bug#24888: pcomplete/cd returns "../" before "./" and does not
 include empty completion in results of pcomplete-at-point
Date: Sun, 6 Nov 2016 20:04:53 -0500
[Message part 1 (text/plain, inline)]
On 2016-11-06 19:15, Dmitry Gutov wrote:
> Does it? It seems to go through comint-completion-at-point here,
> which tries comint-c-a-p-replace-by-expanded-history and
> comint-filename-completion, neither of which reference pcomplete.

Putting a breakpoint in that function and running completion doesn't trigger it for me :)

I see this:

    comint-dynamic-complete-functions is a variable defined in ‘comint.el’.  Its
    value is (comint-c-a-p-replace-by-expanded-history
    shell-environment-variable-completion shell-command-completion
    shell-c-a-p-replace-by-expanded-directory pcomplete-completions-at-point
    shell-filename-completion comint-filename-completion)

pcomplete-completions-at-point comes first, and is missing the "" completion.
There may be a similar problem with comint-filename-completion, of course.

Clément.

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24888; Package emacs. (Mon, 07 Nov 2016 13:50:01 GMT) Full text and rfc822 format available.

Message #14 received at 24888 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Clément Pit--Claudel <clement.pitclaudel <at> live.com>,
 24888 <at> debbugs.gnu.org
Subject: Re: bug#24888: pcomplete/cd returns "../" before "./" and does not
 include empty completion in results of pcomplete-at-point
Date: Mon, 7 Nov 2016 15:48:53 +0200
On 07.11.2016 03:04, Clément Pit--Claudel wrote:

> I see this:
>
>     comint-dynamic-complete-functions is a variable defined in ‘comint.el’.  Its
>     value is (comint-c-a-p-replace-by-expanded-history
>     shell-environment-variable-completion shell-command-completion
>     shell-c-a-p-replace-by-expanded-directory pcomplete-completions-at-point
>     shell-filename-completion comint-filename-completion)

Oh, I see, sorry. M-x shell changes that variable's value.




This bug report was last modified 8 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.