zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Hackers' List <zsh-workers@zsh.org>
Subject: PATCH: updated emulate completion
Date: Fri, 30 Jan 2015 16:19:09 +0000	[thread overview]
Message-ID: <20150130161909.5d1c5f63@pwslap01u.europe.root.pri> (raw)

Seems basically to work, have I missed anything?  The -A '-*' that was
there before seemed a bit pedantic and screwed up the use of -c.

pws

diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh
index 104c757..21ebfc3 100644
--- a/Completion/Unix/Command/_sh
+++ b/Completion/Unix/Command/_sh
@@ -10,8 +10,7 @@ if [[ $service == zsh ]]; then
 fi
 
 if (( CURRENT == ${words[(i)-c]} + 1 )); then
-  compset -q
-  _normal
+  _cmdstring
 else
   local n=${words[(b:2:i)[^-]*]}
   if (( n <= CURRENT )); then
diff --git a/Completion/Unix/Type/_cmdstring b/Completion/Unix/Type/_cmdstring
new file mode 100644
index 0000000..fb19fdb
--- /dev/null
+++ b/Completion/Unix/Type/_cmdstring
@@ -0,0 +1,6 @@
+#autoload
+
+# This is for a quoted argument that will be interpreted as a command.
+
+compset -q
+_normal
diff --git a/Completion/Zsh/Command/_emulate b/Completion/Zsh/Command/_emulate
index e562d68..d6fb0c3 100644
--- a/Completion/Zsh/Command/_emulate
+++ b/Completion/Zsh/Command/_emulate
@@ -1,6 +1,8 @@
 #compdef emulate
 
-_arguments -C -s -A "-*" \
+_arguments -C -s \
   '-L[set local_options and local_traps as well]' \
   '-R[reset all options instead of only those needed for script portability]' \
-  '::shell to emulate:(zsh sh ksh csh)'
+  '1:shell to emulate:(zsh sh ksh csh)' \
+  '2:specify optional command:(-c)' \
+  '3:command:_cmdstring'


             reply	other threads:[~2015-01-30 16:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 16:19 Peter Stephenson [this message]
2015-01-30 16:56 ` Bart Schaefer
2015-01-30 17:20   ` Peter Stephenson
2015-01-30 17:32   ` Oliver Kiddle

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=20150130161909.5d1c5f63@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --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).