From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2632 invoked by alias); 30 Jan 2015 16:19:34 -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: 34435 Received: (qmail 10030 invoked from network); 30 Jan 2015 16:19:21 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,T_HDRS_LCASE,T_MANY_HDRS_LCASE autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-27-54cbae74ebf8 Date: Fri, 30 Jan 2015 16:19:09 +0000 From: Peter Stephenson To: Zsh Hackers' List Subject: PATCH: updated emulate completion Message-id: <20150130161909.5d1c5f63@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphluLIzCtJLcpLzFFi42I5/e/4Nd2SdadDDO5vkrE42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGa23LAt6uCvutj1iamDs4uxi5OSQEDCRuNV2mxHCFpO4cG89 WxcjF4eQwFJGic97V7NDOEuYJM63HmKGcLYxSvy6dpIJpIVFQFXi5P3TYO1sAoYSUzfNBrI5 OEQEtCXaP4qBhIUFtCSO//sNVsIrYC+xuekzM4jNL6AvcfXvJyaIzfYSM6+cgaoRlPgx+R4L iM0M1Lt5WxMrhC0vsXnNW7BeIQF1iRt3d7NPYBSYhaRlFpKWWUhaFjAyr2IUTS1NLihOSs81 1CtOzC0uzUvXS87P3cQICcEvOxgXH7M6xCjAwajEw3sj8XSIEGtiWXFl7iFGCQ5mJRHeKZOA QrwpiZVVqUX58UWlOanFhxiZODilGhijrqUdff6WPS5wvW8TF8+llFynIEEzfcbJ71g6JPNS 7G3OvtmSc1RD/v+XVWc6L3w+Mb+e/SvrRqN9X1SdlD0j/oWc5Y7puG7bLXbFxqz2gtz1xtvx 54W/vplVM21aQoyBqayAgFDfpo99LdE94jO+PeE4rPRh7gu9/y5/g5pnV2d/rJS5uVaJpTgj 0VCLuag4EQCin1RcHwIAAA== 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'