Bug#864493: notmuch: bash completion eats typed option

Łukasz Stelmach l.stelmach at samsung.com
Wed Aug 23 01:59:47 PDT 2017


It was <2017-08-20 nie 15:25>, when Jani Nikula wrote:
> On Sat, 10 Jun 2017, Łukasz Stelmach <l.stelmach at samsung.com> wrote:
>> It was <2017-06-09 pią 17:28>, when David Bremner wrote:
>>> Łukasz Stelmach <l.stelmach at samsung.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20170823/beeae19d/attachment.sig>


More information about the notmuch mailing list