Re: Bug#864493: notmuch: bash completion eats typed option

classic Classic list List threaded Threaded
6 messages Options
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

Łukasz Stelmach <[hidden email]> writes:

> Package: notmuch
> Version: 0.23.5-1~bpo8+1
> Severity: minor
>
> Dear Maintainer,
>
> When I type in bash
>
>     notmuch search --output=<TAB><TAB>
>
> available options appear
>
>     files     messages  summary   tags      threads  
>
> After typing
>
>     notmuch search --output=fi<TAB>
>
> I end up with
>
>     notmuch search files
>
> instead of
>
>     notmuch search --output=files
>

Hi Lukas;

What version of the bash-completion package do you have installed?

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Łukasz Stelmach-2 Łukasz Stelmach-2
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

It was <2017-06-09 pią 17:28>, when David Bremner wrote:
> Łukasz Stelmach <[hidden email]> writes:
[...]

>> After typing
>>
>>     notmuch search --output=fi<TAB>
>>
>> I end up with
>>
>>     notmuch search files
>>
>> instead of
>>
>>     notmuch search --output=files
>>
>
> What version of the bash-completion package do you have installed?
1:2.1-4.2

Let my try 1:2.1-4.3~bpo8+1… Still the same. )-:

--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (482 bytes) Download Attachment
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

On Sat, 10 Jun 2017, Łukasz Stelmach <[hidden email]> wrote:

> It was <2017-06-09 pią 17:28>, when David Bremner wrote:
>> Łukasz Stelmach <[hidden email]> writes:
> [...]
>>> After typing
>>>
>>>     notmuch search --output=fi<TAB>
>>>
>>> I end up with
>>>
>>>     notmuch search files
>>>
>>> instead of
>>>
>>>     notmuch search --output=files
>>>
>>
>> What version of the bash-completion package do you have installed?
>
> 1:2.1-4.2
>
> Let my try 1:2.1-4.3~bpo8+1… Still the same. )-:

Is this still an issue? I can't reproduce this using bash-completion
1:2.1-4.3.

Only two things I can think of: Please make sure you're actually using
the bash completion package you cite, i.e. you don't include some old
version locally. Please try without personal customization in your
.bashrc and friends.

BR,
Jani.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Łukasz Stelmach-2 Łukasz Stelmach-2
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

It was <2017-08-20 nie 15:25>, when Jani Nikula wrote:

> On Sat, 10 Jun 2017, Łukasz Stelmach <[hidden email]> wrote:
>> It was <2017-06-09 pią 17:28>, when David Bremner wrote:
>>> Łukasz Stelmach <[hidden email]> writes:
>> [...]
>>>> After typing
>>>>
>>>>     notmuch search --output=fi<TAB>
>>>>
>>>> I end up with
>>>>
>>>>     notmuch search files
>>>>
>>>> instead of
>>>>
>>>>     notmuch search --output=files
>>>
>>> What version of the bash-completion package do you have installed?
>>
>> 1:2.1-4.2
>>
>> Let my try 1:2.1-4.3~bpo8+1… Still the same. )-:
>
> Is this still an issue? I can't reproduce this using bash-completion
> 1:2.1-4.3.
>
> Only two things I can think of: Please make sure you're actually using
> the bash completion package you cite, i.e. you don't include some old
> version locally. Please try without personal customization in your
> .bashrc and friends.
I looked carefuly and I am sure I use only packaged bash-completion
configuration. I looked also at other commands which use the
--long-option=VALUE pattern (e.g. mkinitrd --with=, nslookup -class=)
and completions for them fail the same way, so it seems more like
bash-completion issue rather than notmuch one.

However, as far as I can tell this isn't unexpected behaviour. With

    notmuch search --output=fi

in the command line the following line is executed

    COMPREPLY=( $( compgen -W "summary threads messages files tags" -- "${cur}" ) )

A few lines before "_init_completion -s" is called which sets ${prev} to
"--output" and ${cur} "fi" due to _split_longopt being called. If I
understand it readline replaces the whole word as it was before
splitting ("${prev}=${cur}"). Hence the fix is to add -P "${prev}=" like this.

    COMPREPLY=( $( compgen -P "${prev}=" -W "summary threads messages files tags" -- "${cur}" ) )

Is there a general way to tell the completion engine not to replace
anything before (and including) "="?

Kind regards,
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (482 bytes) Download Attachment
Jani Nikula Jani Nikula
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

On Wed, Aug 23, 2017 at 11:59 AM, Łukasz Stelmach
<[hidden email]> wrote:
> I looked carefuly and I am sure I use only packaged bash-completion
> configuration. I looked also at other commands which use the
> --long-option=VALUE pattern (e.g. mkinitrd --with=, nslookup -class=)
> and completions for them fail the same way, so it seems more like
> bash-completion issue rather than notmuch one.

mkinitrd --with= and nslookup -class= completions work for me just
fine. Indeed does not look like a notmuch specific issue to me either.

> Is there a general way to tell the completion engine not to replace
> anything before (and including) "="?

I thought _init_completion -s parameter would cover it.

What do you have in $COMP_WORDBREAKS?

Do you have a customized ~/.inputrc?


BR,
Jani.
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Łukasz Stelmach-2 Łukasz Stelmach-2
Reply | Threaded
Open this post in threaded view
|

Re: Bug#864493: notmuch: bash completion eats typed option

Control: reassign -1 npm 1.4.21+ds-2

Dear Maintainer of the npm package.

The reassignment of COMP_WORDBREAKS variable in
/etc/bash_completion.d/npm causes serious problems described in this bug.

It was <2017-08-23 śro 11:27>, when Jani Nikula wrote:

> On Wed, Aug 23, 2017 at 11:59 AM, Łukasz Stelmach
> <[hidden email]> wrote:
>> I looked carefuly and I am sure I use only packaged bash-completion
>> configuration. I looked also at other commands which use the
>> --long-option=VALUE pattern (e.g. mkinitrd --with=, nslookup -class=)
>> and completions for them fail the same way, so it seems more like
>> bash-completion issue rather than notmuch one.
>
> mkinitrd --with= and nslookup -class= completions work for me just
> fine. Indeed does not look like a notmuch specific issue to me either.
>
>> Is there a general way to tell the completion engine not to replace
>> anything before (and including) "="?
>
> I thought _init_completion -s parameter would cover it.
>
> What do you have in $COMP_WORDBREAKS?
    $ printf "$COMP_WORDBREAKS" | hexdump -vC
    00000000  20 09 0a 22 27 40 3e 3c  3d 3b 7c 26 28 3a        | .."'@><=;|&(:|
    $ COMP_WORDBREAKS="=${COMP_WORDBREAKS}"

Bingo!

    $ fgrep -r COMP_WORDBREAKS /etc

And the answer is:

    /etc/bash_completion.d/npm:COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}


Thank you very much for your assistance. I am reassigning the bug to the
npm package.
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (482 bytes) Download Attachment