unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point
@ 2016-11-05 23:53 Clément Pit--Claudel
  2016-11-07  0:15 ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Clément Pit--Claudel @ 2016-11-05 23:53 UTC (permalink / raw)
  To: 24888


[-- Attachment #1.1.1: Type: text/plain, Size: 1297 bytes --]

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

[-- Attachment #1.1.2: pcomplete.png --]
[-- Type: image/png, Size: 9204 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point
  2016-11-05 23:53 bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point Clément Pit--Claudel
@ 2016-11-07  0:15 ` Dmitry Gutov
  2016-11-07  1:04   ` Clément Pit--Claudel
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Gutov @ 2016-11-07  0:15 UTC (permalink / raw)
  To: Clément Pit--Claudel, 24888

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point
  2016-11-07  0:15 ` Dmitry Gutov
@ 2016-11-07  1:04   ` Clément Pit--Claudel
  2016-11-07 13:48     ` Dmitry Gutov
  0 siblings, 1 reply; 4+ messages in thread
From: Clément Pit--Claudel @ 2016-11-07  1:04 UTC (permalink / raw)
  To: Dmitry Gutov, 24888


[-- Attachment #1.1: Type: text/plain, Size: 868 bytes --]

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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point
  2016-11-07  1:04   ` Clément Pit--Claudel
@ 2016-11-07 13:48     ` Dmitry Gutov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Gutov @ 2016-11-07 13:48 UTC (permalink / raw)
  To: Clément Pit--Claudel, 24888

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-07 13:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-05 23:53 bug#24888: pcomplete/cd returns "../" before "./" and does not include empty completion in results of pcomplete-at-point Clément Pit--Claudel
2016-11-07  0:15 ` Dmitry Gutov
2016-11-07  1:04   ` Clément Pit--Claudel
2016-11-07 13:48     ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).