Subject: Re: bug#42411: Bug with M-x compile

From: Eli Zaretskii <[email-masked]>
Date: Sat, 25 Jul 2020 10:24:46 +0300

> Date: Sat, 18 Jul 2020 09:01:48 +0000
> From: Gregory Heytings via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <[email-masked]>
> 
> There are too many completion candidates in the list of targets when 
> completing M-x compile.  For example, for the Makefile 
> "foo:\n\techo\x20bar:\n" three candidates are displayed: "foo", "echo" and 
> "bar".  The regexp in pcmpl-gnu-make-targets is too large, and should be 
> fixed as follows:

I'm not sure your proposed change is TRT.  It could very well cause
the opposite problem: valid targets are not proposed as completion
candidates.

You seem to assume that the valid candidates are only those that
appear as explicit targets in a Makefile.  But that disregards
implicit targets, which Make intuits on its own.  In the example you
show, those implicit targets make no sense, but that's not the only
use case we might want to support.  In a more general case, there
could be targets collected that way which are non-trivial, and which
users may wish to have as completion candidates.

Another situation we need to consider is the X makefiles, where
target names were preceded by whitespace.

And there could be other situations as well.  I'm not an expert; if we
want to review all the possible use cases, perhaps we should ask Paul
Smith, the GNU Make maintainer, to join this discussion and help us
enumerate the possible cases.

So I think we could have the change you propose as an optional
feature, but certainly not as the only behavior.  We could later
discuss whether this would be an opt-in or opt-out, but IMO it must be
controlled by a user option.

Thanks.