Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 0/3] completion: make: various improvements



> 2022/07/30 10:03, Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote:
> 
> While using `call-command` I found very serious issues, for starters
> trying to complete `make` in the zsh source code takes several minutes
> to complete.
> 
>  zstyle ':completion:*:make:*:targets' call-command true

Thanks.
Could you please update [PATCH 2/3]?
(The comment for [PATCH 1/3] is just a note and can be ignored.)


[PATCH 1/3]
> At least in GNU make 4.3 the -n option is *not* respected and
> --always-make builds everything.

This is indeed serious; just hitting <TAB> for completion should
_never_ build anything.

> Instead use a fake .DEFAULT target the way bash-completion does.

If there is a target .DEFAULT in the user's Makefile, its recipe
is not executed (due to the -n option) but is echoed to stdout
(although the -s option is passed to make; I don't know why).
In the _worst_ case this may confuse make-parseDataBase().
For example, if Makefile has the following two lines:

.DEFAULT:
 	echo foo: bar

then the output of 'make -nsp .DEFAULT' contains a line

echo foo: bar

and 'echo foo' will be offered as a possible target.
But I think we can ignore such (extremely) rare cases.


[PATCH 2/3]
> The make program does all the heavy lifting, there's no need to use a
> full parser.

With this patch, if I type 'make <TAB>' in the zsh src directory,
it offers the following files as targets:
    configure.ac, Makefile.in, aclocal.m4   etc.
These are not make targets, and in the output of 'make -nsp',
these are preceded by a line

# Not a target:

I think a (wrong) target after this line should be ignored.




Messages sorted by: Reverse Date, Date, Thread, Author