unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "Łukasz Stelmach" <l.stelmach@samsung.com>
To: Jani Nikula <jani@nikula.org>
Cc: David Bremner <david@tethera.net>,
	notmuch@notmuchmail.org, 864493-maintonly@bugs.debian.org
Subject: Re: Bug#864493: notmuch: bash completion eats typed option
Date: Wed, 23 Aug 2017 10:59:47 +0200	[thread overview]
Message-ID: <87mv6qr75o.fsf%l.stelmach@samsung.com> (raw)
In-Reply-To: <87a82ul6bx.fsf@nikula.org>

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

It was <2017-08-20 nie 15:25>, when Jani Nikula wrote:
> On Sat, 10 Jun 2017, Łukasz Stelmach <l.stelmach@samsung.com> wrote:
>> It was <2017-06-09 pią 17:28>, when David Bremner wrote:
>>> Łukasz Stelmach <l.stelmach@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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  parent reply	other threads:[~2017-08-23  9:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170609134256eucas1p2fe93ad1348f8c6befb4e2449c7e7f354@eucas1p2.samsung.com>
     [not found] ` <877f0lxoo8.fsf%l.stelmach@samsung.com>
2017-06-09 15:28   ` Bug#864493: notmuch: bash completion eats typed option David Bremner
     [not found]     ` <CGME20170610103627eucas1p114948786db76094d5906857298785722@eucas1p1.samsung.com>
2017-06-10 10:36       ` Łukasz Stelmach
2017-08-20 13:25         ` Jani Nikula
     [not found]           ` <CGME20170823090005eucas1p126f0a1b6681a9c314199669de4a9a9ad@eucas1p1.samsung.com>
2017-08-23  8:59             ` Łukasz Stelmach [this message]
2017-08-23  9:27               ` Jani Nikula
     [not found]                 ` <CGME20170823105559eucas1p18f288bd2e8827bf858c1227cfbc26487@eucas1p1.samsung.com>
2017-08-23 10:55                   ` Łukasz Stelmach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mv6qr75o.fsf%l.stelmach@samsung.com \
    --to=l.stelmach@samsung.com \
    --cc=864493-maintonly@bugs.debian.org \
    --cc=david@tethera.net \
    --cc=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).