From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26180 invoked by alias); 15 Mar 2013 21:42:14 -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: 31156 Received: (qmail 19888 invoked from network); 15 Mar 2013 21:42:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.212.182 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-proxyuser-ip:date:from:to:subject:message-id:x-mailer :mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=bEaRuYRNRmW4uqmgL+F+6b4ISXsluFUZZ6b5ucPknjU=; b=MhG/T0AtSF8P4ejtODkD01ojs7Hgy7ZNCNF+y5YfLgv8xbLe5TlbsOt2hQ5mrhiWrD bVJsUJ+QRhb8VifMQ90NQaqGfns7rcmzFJ36ahlizGAOeVofGS4bxZeby1YkuQw+SC4N 22WgLtSFlN9KAXQsGIVu9hZNvizuTf8A2oAJfCUch9XQEv1lVC+SeHZreY1q/93RFdda DLpUa0bcbXCI6SdW/LtiTjiaQVxd05Z3w9pvqi7hbDR87vnpSSxGa89UcthBoOiKxKoM 8wvXAzfULIJ+xAWMXPMZ5WksLvGrqkVlXDyTgDHvDZqm4c5ZW+7BUH+4NWm/I48TM4vH jM1Q== X-Received: by 10.180.24.229 with SMTP id x5mr5852319wif.17.1363383724903; Fri, 15 Mar 2013 14:42:04 -0700 (PDT) X-ProxyUser-IP: 86.26.6.143 Date: Fri, 15 Mar 2013 21:42:01 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: PATCH: improved completion in math context Message-ID: <20130315214201.4233b3b0@pws-pc.ntlworld.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmN7gRN9H51KINJN73VZA82Oa6fkYRl4P2ISg0h7InXXfxfiJXFz3YDIrRiS+3JS1OnVKM4 Index: Completion/Zsh/Context/_math =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_math,v retrieving revision 1.1 diff -p -u -r1.1 _math --- Completion/Zsh/Context/_math 2 Apr 2001 11:23:46 -0000 1.1 +++ Completion/Zsh/Context/_math 15 Mar 2013 21:41:12 -0000 @@ -9,4 +9,6 @@ if [[ "$SUFFIX" = *[^a-zA-Z0-9_]* ]]; th SUFFIX="${SUFFIX%%[^a-zA-Z0-9_]*}" fi -_parameters -g '(integer|float)*' || _parameters +_alternative 'integer-parameters:integer parameter: _math_params' \ + 'user-math-functions:user math function: _user_math_func' \ + 'module-math-functions:math function from zsh/mathfunc: _module_math_func' Index: Completion/Zsh/Context/_zcalc_line =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_zcalc_line,v retrieving revision 1.2 diff -p -u -r1.2 _zcalc_line --- Completion/Zsh/Context/_zcalc_line 13 Jun 2008 14:27:37 -0000 1.2 +++ Completion/Zsh/Context/_zcalc_line 15 Mar 2013 21:41:12 -0000 @@ -13,7 +13,7 @@ _zcalc_line_escapes() { "eng:engineering (power of 1000) output format" "raw:raw output format" "local:make variables local" - "function:define math function" + "function:define math function (also \:func or \:f)" ) cmds=("\:"${^cmds}) _describe -t command-escapes "command escapes" cmds -Q Index: Completion/Zsh/Type/.distfiles =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/.distfiles,v retrieving revision 1.4 diff -p -u -r1.4 .distfiles --- Completion/Zsh/Type/.distfiles 10 Nov 2008 15:28:42 -0000 1.4 +++ Completion/Zsh/Type/.distfiles 15 Mar 2013 21:41:12 -0000 @@ -15,10 +15,13 @@ _jobs _jobs_bg _jobs_fg _limits +_math_params +_module_math_func _options _options_set _options_unset _parameters _suffix_alias_files +_user_math_func _vars ' Index: Completion/Zsh/Type/_math_params =================================================================== RCS file: Completion/Zsh/Type/_math_params diff -N Completion/Zsh/Type/_math_params --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Completion/Zsh/Type/_math_params 15 Mar 2013 21:41:12 -0000 @@ -0,0 +1,3 @@ +#autoload + +_parameters -g '(integer|float)*' || _parameters Index: Completion/Zsh/Type/_module_math_func =================================================================== RCS file: Completion/Zsh/Type/_module_math_func diff -N Completion/Zsh/Type/_module_math_func --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Completion/Zsh/Type/_module_math_func 15 Mar 2013 21:41:12 -0000 @@ -0,0 +1,9 @@ +#autoload + +local expl +local -a funcs + +funcs=(${${${(f)"$(zmodload -Fl zsh/mathfunc 2>/dev/null)"}:#^+f:*}##+f:}) + +_wanted module-math-functions expl 'math function from zsh/mathfunc' \ + compadd -S '(' "$@" -a funcs Index: Completion/Zsh/Type/_user_math_func =================================================================== RCS file: Completion/Zsh/Type/_user_math_func diff -N Completion/Zsh/Type/_user_math_func --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Completion/Zsh/Type/_user_math_func 15 Mar 2013 21:41:12 -0000 @@ -0,0 +1,9 @@ +#autoload + +local expl +local -a funcs + +funcs=(${${${(f)"$(functions -M)"}##functions -M }%% *}) + +_wanted user-math-functions expl 'user math function' \ + compadd -S '(' "$@" -a funcs -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/