zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: use argument sets style in _compdef and _zpty; Re: FD_CLOEXEC
Date: Thu, 25 May 2000 16:03:18 +0100	[thread overview]
Message-ID: <392D40B6.A2FC0DA8@u.genie.co.uk> (raw)

Peter Stephenson wrote:

> I developed zftp under AIX, so it's just possible something funny is going
> on there.  Maybe Oliver could check it at least compiles?

Firstly, Peter: I have recompiled with your zftp patch on AIX without
any problems. Judging by the AIX man pages, your patch is correct and it
was wrong before. I did a few basic tests of zftp and it all worked
fine. If you can think of a specific test which will cover your changed
code, I can try that.

Secondly, I have updated the compset and zpty completions to use the
argument sets thing. This showed up a couple of possible bugs:

zpty -e<tab> doesn't exclude all the other options (apart from -b)
zpty -e -<tab> does work though

and

% zpty -w l <tab>
_arguments:shift:297: shift count must be <= $#

I'm not sure that the latter one isn't the syntax being wrong in the
_arguments call in _zpty. It occurs with the previous _zpty so is
not related to the argument sets stuff.

Oliver

Index: Completion/Builtins/_compdef
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_compdef,v
retrieving revision 1.5
diff -u -c -r1.5 _compdef
*** Completion/Builtins/_compdef	2000/05/05 13:38:46	1.5
--- Completion/Builtins/_compdef	2000/05/25 14:56:00
***************
*** 6,18 ****
  _arguments -C -s \
    '(-d)-a[make function autoloadable]' \
    '(-d -p -P)-n[leave existing definitions intact]' \
-   '(-a -n -p -P -k -K)-d[delete]:*:completed command:->ccom' \
-   '(-n -d -P -k -K)-p[completion for command matching pattern]:completion function:->cfun:pattern' \
-   '(-n -d -p -k -K)-P[as -p for commands without own completion]:completion function:->cfun:pattern' \
-   '(-d -p -P -K)-k[define widget and key binding]:completion function:->cfun:style:->style:*:key' \
-   '(-d -p -P -k)-K[define multiple widgets based on function]:*::: :->multi' \
    ':completion function:->cfun' \
!   '*:commands: _command_names' && return 0
  
  if [[ $state = multi ]]; then
    case $(( CURRENT % 3 )) in
--- 6,23 ----
  _arguments -C -s \
    '(-d)-a[make function autoloadable]' \
    '(-d -p -P)-n[leave existing definitions intact]' \
    ':completion function:->cfun' \
!   '*:commands: _command_names' \
!  - d \
!   '(-a -n)-d[delete]:*:completed command:->ccom' \
!  - p \
!   '(-n)-p[completion for command matching pattern]:completion function:->cfun:pattern' \
!  - P \
!   '(-n)-P[as -p for commands without own completion]:completion function:->cfun:pattern' \
!  - k \
!   '-k[define widget and key binding]:completion function:->cfun:style:->style:*:key' \
!  - K \
!   '-K[define multiple widgets based on function]:*::: :->multi' && return 0
  
  if [[ $state = multi ]]; then
    case $(( CURRENT % 3 )) in
Index: Completion/Builtins/_zpty
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zpty,v
retrieving revision 1.5
diff -u -c -r1.5 _zpty
*** Completion/Builtins/_zpty	2000/05/05 13:38:46	1.5
--- Completion/Builtins/_zpty	2000/05/25 14:56:00
***************
*** 4,18 ****
  typeset -A opt_args
  
  _arguments -C -s \
!   '(-d -w -r -L)-e[echo input characters]' \
!   '(-d -w -r -L)-b[io to pseudo-terminal blocking]' \
!   '(-e -b -w -r -L)-d[delete command]:*:name:->name' \
!   '(-e -b -d -r -L)-w[send string to command]:name:->name:*:strings to write' \
!   '(-e -b -d -w -L *)-r[read string from command]:name:->name:param:_parameters' \
!   '(-e -b -d -w -r)-L[list defined commands as calls]' \
!   '(-r)*::args:_normal' && return 0
  
  if [[ $state = name ]]; then
    list=( ${${(f)"$(zpty)"}#*\) } )
    names=( ${list%%:*} )
    if zstyle -T ":completion:${curcontext}" verbose; then
--- 4,27 ----
  typeset -A opt_args
  
  _arguments -C -s \
!   '(-r)*::args:_normal' \
!  - eb \
!   '-e[echo input characters]' \
!   '-b[io to pseudo-terminal blocking]' \
!  - d \
!   '-d[delete command]:*:name:->name' \
!  - w \
!   '-w[send string to command]:name:->name:*:strings to write' \
!  - L \
!   '-L[list defined commands as calls]' \
!  - r \
!   '(*)-r[read string from command]:name:->name:param:_parameters' && return 0
  
  if [[ $state = name ]]; then
+   if ! zmodload -e zsh/zpty; then
+     _message "zpty module not loaded"
+     return 1
+   fi
    list=( ${${(f)"$(zpty)"}#*\) } )
    names=( ${list%%:*} )
    if zstyle -T ":completion:${curcontext}" verbose; then


             reply	other threads:[~2000-05-25 15:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-25 15:03 Oliver Kiddle [this message]
2000-05-25 15:42 ` Bart Schaefer
2000-05-29  7:59 Sven Wischnowsky

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=392D40B6.A2FC0DA8@u.genie.co.uk \
    --to=opk@u.genie.co.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).