From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5515 invoked by alias); 31 Aug 2016 09:10:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39140 Received: (qmail 20655 invoked from network); 31 Aug 2016 09:10:05 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.28):SA:0(0.0/5.0):. Processed in 0.76801 secs); 31 Aug 2016 09:10:05 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=phGTroWpO5fYL8Lx CPQbprTz8BI=; b=zIUiuHQ+6+VUbnBuhxl9eyNhsXPIq44tNmvbhly8DbDAZquF WJp6sTF7BGe6KH2+FDIv0MewLQTIc95lVmBNoNSPzLG2AVlDoSGfLhzZaFhjEb5d LBPCFdoZjtji24YcJDr89HTcMmEJu6yFNk6LXvpAriqXCbF+enSUg4Dt1oM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=phGTroWpO5fYL8L xCPQbprTz8BI=; b=ajKn2mI3GkpiEesHn5zAf687CCKw4fumYvDk1z05ktHt+Xk 34E6m5Oa7NRY5tEQ6iJxX7FjQpInv9NYQ/XFJ8XIF60ip7oUArbsXpD0SVOS+TxJ 9Bgk7X9JBtpFc0Lg92VRqbuz47E6FWqVsIhUcEmDxR4GWyS49MuPMWmHdnOI= X-Sasl-enc: cpc4YK8eFysJbZ1UA5N6c10uTdMpqU4mFw2h4WVZXUTD 1472634598 Date: Wed, 31 Aug 2016 09:09:50 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: buggy configure completion - when both --enable-foo and --disable-foo are listed Message-ID: <20160831090950.GA8748@fujitsu.shahaf.local2> References: <20160830232332.GA23779@zira.vinc17.org> <20160831030055.GC30557@fujitsu.shahaf.local2> <20160831061555.GA15435@zira.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160831061555.GA15435@zira.vinc17.org> User-Agent: Mutt/1.5.23 (2014-03-12) 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 -- > > --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- --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 > 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 --» 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' to get compsys to fill in the rest of the word "-enable-dynamic". 3) «./configure --e» 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