GNU bug report logs - #76817
30.1; completion-preview and shell

Previous Next

Package: emacs;

Reported by: Rufus Segar <rhs <at> riseup.net>

Date: Fri, 7 Mar 2025 17:27:02 UTC

Severity: normal

Found in version 30.1

Full log


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

From: Eshel Yaron <me <at> eshelyaron.com>
To: Rufus Segar <rhs <at> riseup.net>
Cc: 76817 <at> debbugs.gnu.org
Subject: Re: bug#76817: 30.1; completion-preview and shell
Date: Fri, 07 Mar 2025 19:47:09 +0100
Hi Rufus,

Rufus Segar <rhs <at> riseup.net> writes:

> It appears that completion-preview-mode is not quite working as intended
> with shell. When inserting path completions it inserts a trailing space.

The trailing space comes from the :exit-function that the completion
backend specifies.  completion-preview-mode calls that :exit-function
when you insert a completion suggestion, so in that sense it does work
as intended.

Of course, I agree that this trailing space is undesirable for exactly
the reason you describe below.  You can disable it, as I do, by setting
either pcomplete-termination-string or pcomplete-exit-function.  Do you
get a better behavior with (setq pcomplete-termination-string "") ?

> An example will show why this is undesirable:
>
> Say I want to complete path `~/foobar/baz'. I start with `cd ~/foob` and
> completion-preview successfully completes the 'foobar' portion. However,
> after I do completion-preview-insert I'm left with the following:
>
> "cd ~/foobar/ "
>              ^-- Notice the trailing space
>
> This means that if I want to continue completing my path all the way to
> '~/foobar/baz', I have to delete that trailing space. completion-preview
> should not leave a trailing space, and if possible immediately continue
> completing the path, so that in this case I'm given '~/foobar/baz' as my
> next completion candidate and can simply call completion-preview-insert
> again to get the full path.
>
> P.S. I'm loving completion-preview-mode by the way, I can tell that a
> lot of care was put into this mode. I'm looking forward to this issue
> being resolved so that I can use it in my shell too.

Thanks!

Eshel




This bug report was last modified 97 days ago.

Previous Next


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