4
votes

gnu/make supports non-latin identifiers (f.e., targets) in makefile.

example:

$ cat GNUmakefile
test:
  @echo test
тест:
  @echo test in russian

$ make test тест
test
test in russian

but the bash-completion with this example completes only one target — test:

"make " + tab → "make test".

how to add non-latin targets to completion list?


tested on various list of distributions (debian 5-8, ubuntu 12-15, centos 5-6, mandriva 2008) with different versions of bash-completion.

i need support for this feature at least with recent version of the bash-completion.

2
Please add OS/distribution and version to your question.Cyrus
@Cyrus, i've updated the question.aleksandr barakin

2 Answers

4
votes

i found the solution.

bug in the function _make_target_extract_script from the file /usr/share/bash-completion/completions/make, which returns sed-script, which contains line:

/^[^a-zA-Z0-9]/             d             # convention for hidden tgt

which removes the targets that begins (in particular) with a non-latin character.

such a regexp would be more appropriate, in my opinion (see this):

/^[^[[:alnum:]]]/             d             # convention for hidden tgt

if you can not edit the /usr/share/bash-completion/completions/make, you can add to ~/.bashrc such lines (based on this answer):

_completion_loader make
eval "$(type _make_target_extract_script | sed '1d;s/a-zA-Z0-9/[[:alnum:]]/')"

update

i submit a bug report (unfortunately, registration required).

1
votes

The direct solution would be to switch to zsh with oh-my-zsh if you want to see this working.

enter image description here

Bash is known for various bugs and unsupported features. zsh works 2 times faster and almost fully compatible with bash POSIX shell, so most of your bashrc and shell scripts will work the same way with either bash and zsh.