zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: Re: buggy configure completion - when both --enable-foo and --disable-foo are listed
Date: Wed, 31 Aug 2016 09:09:50 +0000	[thread overview]
Message-ID: <20160831090950.GA8748@fujitsu.shahaf.local2> (raw)
In-Reply-To: <20160831061555.GA15435@zira.vinc17.org>

Vincent Lefevre wrote on Wed, Aug 31, 2016 at 08:15:55 +0200:
> On 2016-08-31 03:00:55 +0000, Daniel Shahaf wrote:
> > Vincent Lefevre wrote on Wed, Aug 31, 2016 at 01:23:32 +0200:
> > > With zsh 5.2, I get the following, which doesn't make sense:
> > > 
> > > zira:~/software/mpfr> ./configure --enable-decimal-float[Tab]
> > > Completing option
> > > --enable-decimal-float  -- build conversion functions from/to decimal floats
> > > --enable-decimal-float  -- explicitly disable decimal floats support
> > > 
> > > One has from the "configure --help" output:
> > > 
> > >   --disable-decimal-float explicitly disable decimal floats support
> > >   --enable-decimal-float  build conversion functions from/to decimal floats
> > >                           [default=autodetect]
> > 
> > What do you expect to see?  How should the two strings ("build .." and
> > "explicitly ...") be handled?
> > 
> > Minimal example:
> > 
> > % print -rl -- '#!/bin/sh' 'cat <<"EOF"' '  --enable-foo  enable foo' '  --disable-foo  disable foo' 'EOF' >configure
> > % chmod +x configure
> > % ./configure --<TAB>
> > --disable-foo  --enable-foo  -- enable foo                                    
> > --disable-foo  --enable-foo  -- disable foo                                   
> 
> The problem is that it says "build conversion functions from/to
> decimal floats" after --enable-decimal-float while it corresponds
> to --disable-decimal-float.

I see.  I missed that in my previous reply.  Thanks for spelling it out.

I agree, the current completion is misleading.  This occurs with zsh's
configure script too:
.
% ./configure --enable-<TAB>
--enable-dynamic             -- turn off dynamically loaded binary modules

> So, I'd say, either
> 
> --enable-decimal-float  -- build conversion functions from/to decimal floats
> --disable-decimal-float -- explicitly disable decimal floats support
> 

You can sort of get this with a matchspec.  If you take the _configure
function in master, delete the -s parameter, and add a -M parameter,
like this:

_configure () {
        _arguments -M 'B:--en=--dis B:--dis=--en' : -- -i '(--(disable|enable)-FEATURE* --(with|without)-PACKAGE*)' '*=(E|)PREFIX*:prefix directory:_files -/' '*=PROGRAM*:program:_command_names -e' '*=NAME*executable*:program:_command_names -e' '*=NAME*:file:_files'
}

The behaviour of this function is different in three ways from the
_configure function in current master:

1) This function shows the correct --disable/--enable argument to the
left of each description:
.
% ./configure --en<TAB>
> option
--disable-dynamic            - turn off dynamically loaded binary modules
--disable-dynamic-nss        - do not call functions that will require dynamic NSS
--disable-gdbm               - turn off search for gdbm library
   …able-additional-fpath    - add directories to default function path
   …able-ansi2knr            - translate source to K&R C before compiling
   …able-cap                 - enable the search for POSIX capabilities (may
.
... and if you choose one of the first three options, the string inserted
in to the command line is "--enable-dynamic", not "--disable-dynamic".

2) Completing «./configure --<TAB>» will show next to each docstring
*either* the --enable-* or --disable-*, but not both.  This means the
user can tell at a glance whether the docstring describes --enable or
--disable, but also that (in the above example) the user has to type 'e'
'n' <TAB> to get compsys to fill in the rest of the word "-enable-dynamic".

3) «./configure --e<TAB>» won't offer the --enable-* counterparts of
options shown in the first output as --disable-*.  (I assume some smarter
matchspec could take care of this.)

Or maybe there's a better approach that doesn't use matchspecs at all.

> (thus skipping the --disable-decimal-float when one completes on
> --enable[Tab]), or add "=no" for the disable cases, e.g.:
> 
> --enable-decimal-float    -- build conversion functions from/to decimal floats
> --enable-decimal-float=no -- explicitly disable decimal floats support

Cheers,

Daniel


  reply	other threads:[~2016-08-31  9:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30 23:23 buggy configure completion Vincent Lefevre
2016-08-31  3:00 ` buggy configure completion - when both --enable-foo and --disable-foo are listed Daniel Shahaf
2016-08-31  6:15   ` Vincent Lefevre
2016-08-31  9:09     ` Daniel Shahaf [this message]
2016-08-31 20:27   ` m0viefreak
2016-09-02  1:27     ` Bart Schaefer
2016-09-02 21:02       ` m0viefreak
2016-09-07  5:39         ` Bart Schaefer
2016-08-31  3:03 ` Daniel Shahaf
2016-08-31  6:45   ` Vincent Lefevre

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

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

  git send-email \
    --in-reply-to=20160831090950.GA8748@fujitsu.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.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://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).