From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20894 invoked by alias); 30 Jun 2014 11:45:53 -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: 32823 Received: (qmail 20770 invoked from network); 30 Jun 2014 11:45:50 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Biglobe-Sender: Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Subject: Re: [Pkg-zsh-devel] Bug#679824: zsh: Buggy perl completion with -e [origin: vincent@vinc17.net] From: "Jun T." In-Reply-To: <20140628142003.GI5355@sym.noone.org> Date: Mon, 30 Jun 2014 20:45:13 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: <94EEBC97-747A-4D8D-BDF4-65A3B88889B3@kba.biglobe.ne.jp> References: <20140628142003.GI5355@sym.noone.org> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.1878.2) X-Biglobe-Spnum: 56699 Sorry, I fotgot about the array $opt_args, which can be used to detect the -e '...' on the command line. But modifying the line '*::args: _normal' would be also OK. diff --git a/Completion/Unix/Command/_perl = b/Completion/Unix/Command/_perl index b00baa6..1921212 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -4,6 +4,7 @@ # Adam Spiers # # Completions currently based on Perl 5.14.1. +typeset -A opt_args =20 _perl () { _arguments -s \ @@ -40,10 +41,21 @@ _perl () { "(-w -X)-W[enable all warnings (ignores 'no warnings')]" \ "(-w -W )-X[disable all warnings (ignores 'use warnings')]" \ '-x-[strip off text before #!perl line and perhaps cd to = directory]:directory to cd to:_files -/' \ - '1:Perl script:_files -/ -g "*.(p[ml]|PL|t)(-.)"' \ + '1:script or arg:_script_or_arg' \ '*::args: _normal' } =20 +_script_or_arg () { + local expl + if [[ -n "$opt_args[(I)-(e|E)]" ]]; then + _description arg expl 'file' + _files "$expl[@]" + else + _description script expl 'Perl script' + _files "$expl[@]" -/ -g "*.(p[ml]|PL|t)(-.)" + fi +} + _perl_m_opt () { compset -P '-' =20