Subject: Re: bug#74944: 31.0.50; Double TAB does not pop up *Completions* buffer when completing filename with dashes

From: Manuel Giraud <[email-masked]>
Date: Tue, 07 Jan 2025 16:01:32 +0100

Visuwesh <[email-masked]> writes:

[...]

> The second call which moves the before the first '-' makes sense to me
> since to complete further one, one has to insert text before that
> character.  This happens elsewhere too so I am not exactly surprised.
> However, I think this is where the capf gets stuck since Emacs thinks it
> has to complete an option / a flag and the completion engine stops.

Hi Visuwesh,

I was down the rabbit hole on this one and now, I need some fresh air
and, hopefully, advices from experts here.

The culprit seems to be that `shell-filename-completion' does not know
how to complete the filename when the point is on '-' with the following
input in the *shell* buffer:

      $ rm -pos1.xyz

And it is due to the fact that `comint-word' is only looking for a word
*backward*.  I don't understand why is that so I tried to make
`comint-word' also looking for a word forward.  But then the following
assertion in `completion-in-region' is violated:

  (cl-assert (<= start (point)) (<= (point) end))

Does anyone could help me here?
-- 
Manuel Giraud