GNU bug report logs - #51130
29.0.50; shell completion fails to complete filenames

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita2 <at> gmail.com>

Date: Mon, 11 Oct 2021 05:45:02 UTC

Severity: normal

Found in version 29.0.50

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 51130 <at> debbugs.gnu.org, Carlos Pita <carlosjosepita2 <at> gmail.com>
Subject: Re: bug#51130: 29.0.50; shell completion fails to complete filenames
Date: Tue, 13 Sep 2022 09:32:43 -0400
Lars Ingebrigtsen [2022-09-13 13:19:07] wrote:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>>>     * lisp/shell.el: Require and use pcomplete.
>>>     (shell-dynamic-complete-functions): Add pcomplete-completions-at-point.
>>>     (shell-completion-vars): Set pcomplete-default-completion-function.
>>>
>>> Just leaving pcomplete-default-completion-function alone seems to give
>>> better results in shell-mode (after testing very briefly), so I'm not
>>> sure why that was added.
>>
>> It was added because leaving `pcomplete-default-completion-function`
>> alone means that the functions after `pcomplete-completions-at-point` in
>> `shell-dynamic-complete-functions` are not used any more.
>
> Uhm...  I don't follow the logic at all.
> pcomplete-default-completion-function is documented to be applied if
> everything else has failed to do completion, isn't it?

Look at `shell-dynamic-complete-functions`:

    (defcustom shell-dynamic-complete-functions
      '(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)
      "List of functions called to perform completion.
    This variable is used to initialize `comint-dynamic-complete-functions' in the
    shell buffer."
      :type '(repeat function)
      :group 'shell)

if `pcomplete-default-completion-function` is left at its default value,
then `pcomplete-completions-at-point` will never return nil, so the
functions that appear after it in the above list will just never
be used.

The change I introduced tried to preserve as much of the existing
completion as possible, by only using the non-fallback pcomplete rules
and keeping the existing `shell-filename-completion` and
`comint-filename-completion` thingies as the fallback.

I don't know that it's the best choice.  It was just the
conservative choice.


        Stefan





This bug report was last modified 1 year and 287 days ago.

Previous Next


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