zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Bruno Bonfils <asyd@debian-fr.org>
Cc: zsh-workers@sunsite.dk
Subject: Re: read timeout argument || completion of a function
Date: Mon, 12 Aug 2002 15:21:04 +0000	[thread overview]
Message-ID: <1020812152104.ZM29487@candle.brasslantern.com> (raw)
In-Reply-To: <87n0rsxsqr.fsf@julie.debian-fr.org>

On Aug 12, 12:43pm, Bruno Bonfils wrote:
}
} > The default completion is what is called when
} > there isn't any other completion defined, and it is implemented by a
} > function that is named _default, which happens to call another
} > function named _files.
} 
} hmm ok, i understand now. So, in this case, it's possible to change
} the function which called by _default for only one command using
} zstyle ?

No, you cannot, using zstyle, change the functions which are called;
with zstyle you can change some of the function behaviors and in some
cases change the set of possible matches from which they select the list
of matching completions.  To change the functions called, use compdef.

} sure, in fact i have :
} 
} % vi .zshrc
} ...
} source .zsh/rc/functions.rc
} 
} fpath=($HOME/.zsh/functions $fpath)
} ...

And where in that sequence is your call to "compinit"?

} % vi .zsh/rc/functions.rc
} 
} ...
} upgrade () {
}     if [ -z $1 ] ; then
}         sudo apt-get update
}         sudo apt-get -u upgrade
}     else
}         echo "sudo apt-get update" | ssh $1
}         # ask before the upgrade
}         local dummy
}         echo "sudo apt-get --no-act upgrade" | ssh $1
}         echo -n "Process the upgrade ?"
}         read -q dummy
}         if [[ $dummy == "y" ]] ; then
}             echo "sudo apt-get -u upgrade --yes"
}         fi
}     fi
} }

It looks like that always passes its argument to ssh.  So you can just:

	compdef upgrade=ssh

} upgrade <tab>
} file..
} 
} _upgrade <tab>
} host..

I'm at a loss to explain this.  Have you tried using the _complete_help
and _complete_debug key bindings?  Man page excerpt:

_complete_debug (^X?)
     This widget performs ordinary completion, but captures in a
     temporary file a trace of the shell commands executed by the
     completion system.  Each completion attempt gets its own file.  A
     command to view each of these files is pushed onto the editor
     buffer stack.

_complete_help (^Xh)
     This widget displays information about the context names, the
     tags, and the completion functions used when completing at the
     current cursor position. If given a numeric argument other than 1
     (as in `ESC-2 ^Xh'), then the styles used and the contexts for
     which they are used will be shown, too.

     Note that the information about styles may be incomplete; it
     depends on the information available from the completion functions
     called, which in turn is determined by the user's own styles and
     other settings.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


      parent reply	other threads:[~2002-08-12 15:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-11 20:54 Bruno Bonfils
2002-08-12  5:45 ` Bart Schaefer
2002-08-12 10:43   ` Bruno Bonfils
2002-08-12 11:13     ` Oliver Kiddle
2002-08-12 11:41       ` Peter Stephenson
2002-08-12 15:12         ` Bart Schaefer
2002-08-12 15:21     ` Bart Schaefer [this message]

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=1020812152104.ZM29487@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=asyd@debian-fr.org \
    --cc=zsh-workers@sunsite.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).