zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: updated emulate completion
@ 2015-01-30 16:19 Peter Stephenson
  2015-01-30 16:56 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2015-01-30 16:19 UTC (permalink / raw)
  To: Zsh Hackers' List

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'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: updated emulate completion
  2015-01-30 16:19 PATCH: updated emulate completion Peter Stephenson
@ 2015-01-30 16:56 ` Bart Schaefer
  2015-01-30 17:20   ` Peter Stephenson
  2015-01-30 17:32   ` Oliver Kiddle
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Schaefer @ 2015-01-30 16:56 UTC (permalink / raw)
  To: Zsh Hackers' List

On Jan 30,  4:19pm, Peter Stephenson wrote:
}
} +++ 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


Perhaps we could use that in _sh, _sudo, etc.?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: updated emulate completion
  2015-01-30 16:56 ` Bart Schaefer
@ 2015-01-30 17:20   ` Peter Stephenson
  2015-01-30 17:32   ` Oliver Kiddle
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2015-01-30 17:20 UTC (permalink / raw)
  To: Zsh Hackers' List

On Fri, 30 Jan 2015 08:56:04 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Jan 30,  4:19pm, Peter Stephenson wrote:
> }
> } +++ 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
> 
> 
> Perhaps we could use that in _sh, _sudo, etc.?

It's now in _sh, but yes, the idea is this could be more widespread and
if we find command string handling needs tweaking it can happen in one
place.

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: updated emulate completion
  2015-01-30 16:56 ` Bart Schaefer
  2015-01-30 17:20   ` Peter Stephenson
@ 2015-01-30 17:32   ` Oliver Kiddle
  1 sibling, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2015-01-30 17:32 UTC (permalink / raw)
  To: Zsh Hackers' List

Bart wrote:
> }
> } +# This is for a quoted argument that will be interpreted as a command.
> } +compset -q
> } +_normal
> 
> 
> Perhaps we could use that in _sh, _sudo, etc.?

sudo doesn't take a single quoted argument so the compset -q isn't
appropriate for it.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-30 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-30 16:19 PATCH: updated emulate completion Peter Stephenson
2015-01-30 16:56 ` Bart Schaefer
2015-01-30 17:20   ` Peter Stephenson
2015-01-30 17:32   ` Oliver Kiddle

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).