zsh-workers
 help / color / mirror / code / Atom feed
* completion newbie question
@ 2002-03-14 23:30 John Beppu
  2002-03-15  1:17 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: John Beppu @ 2002-03-14 23:30 UTC (permalink / raw)
  To: zsh-workers

I've been trying to learn how to write completions, and
I came across an idiom in _cvs that seems unnecessary.
Before every function definition, there is a guard that
looks like:

    (( $+functions[_cvs_command] )) ||  # ...define function

Maybe I'm wrong, but once _cvs gets loaded, all the other
auxiliary functions in the same file will be loaded, too.
Under normal circumstances, the condition inside the guard
will be false the first time through, and there won't ever
be a second time through, because _cvs won't ever be loaded
again during that session.

What am I missing?



(...otherwise, _cvs is really impressive to me for its
 completeness.  I definitely learned a few new things
 about CVS by looking at the completions for it)



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

* Re: completion newbie question
  2002-03-14 23:30 completion newbie question John Beppu
@ 2002-03-15  1:17 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2002-03-15  1:17 UTC (permalink / raw)
  To: John Beppu; +Cc: zsh-workers

On Thu, 14 Mar 2002, John Beppu wrote:

> I came across an idiom in _cvs that seems unnecessary.
> Before every function definition, there is a guard [...]

The guard is theoretically there so that a user can define his own custom
overrides for each of the guarded functions and simply arrange to have his
own functions autoloaded.  Thus when _cvs is autoloaded, it won't override
the user's existing autoloads for those functions.

In practice I find that all it does is annoy me when I'm debugging, by
making `unfunction _cvs; autoload -U _cvs' insufficient to reload all the
related functions.


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

end of thread, other threads:[~2002-03-15  1:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-14 23:30 completion newbie question John Beppu
2002-03-15  1:17 ` Bart Schaefer

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