zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: [Pkg-zsh-devel] Bug#679824: zsh: Buggy perl completion with -e [origin: vincent@vinc17.net]
Date: Mon, 30 Jun 2014 20:45:13 +0900	[thread overview]
Message-ID: <94EEBC97-747A-4D8D-BDF4-65A3B88889B3@kba.biglobe.ne.jp> (raw)
In-Reply-To: <20140628142003.GI5355@sym.noone.org>

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 <adam@spiers.net>
 #
 # Completions currently based on Perl 5.14.1.
+typeset -A opt_args
 
 _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'
 }
 
+_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 '-'
 



  parent reply	other threads:[~2014-06-30 11:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 14:20 Fwd: " Axel Beckert
2014-06-30 10:58 ` Jun T.
2014-06-30 13:02   ` Jun T.
2014-07-03 15:59     ` Jun T.
2014-07-03 16:11       ` Peter Stephenson
2014-07-03 16:42         ` Bart Schaefer
2014-07-06 21:58   ` Oliver Kiddle
2014-07-23 12:01     ` takimoto-j
2014-06-30 11:45 ` Jun T. [this message]
2014-06-30 19:09   ` Peter Stephenson

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=94EEBC97-747A-4D8D-BDF4-65A3B88889B3@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).