Zsh Mailing List Archive
Messages sorted by:
Re: Equivalent of Vim's has("feature")?
On Nov 22, 2:02pm, Benjamin R. Haskell wrote:
} Is there any support for ZSH_PATCHLEVEL in is-at-least? :a and :A were
} added in ZSH_VERSION=4.3.10(-dev-1?) ZSH_PATCHLEVEL=1.4618.
is-at-least 1.4618 $ZSH_PATCHLEVEL
However, that fails on versions of zsh where ZSH_PATCHLEVEL itself is
not yet defined.
} > you have to attempt to make use of the feature and record the result.
} Both of these seem slippery-slopy. (Easy for one feature, but
} increasingly annoying as more tests are needed.
I don't see any way to avoid "more tests" as features are added, no
matter what form the tests take.
Furthermore, there's a chicken-and-egg problem -- how do you test for
the feature that provides the test for other features?
For example, PWS didn't mention that features derived from modules
(such as the existence of the "widgets" parameter itself) can be
checked by running "zmodload -lF modulename featurespec" as in
zmodload -lF zsh/zleparameter p:widgets
However, this is the egg of the zmodload chicken, because the feature
of modules providing named lists of their features is also relatively
} Also, if a given feature takes non-trivial time to test.)
At some point one has to recognize that it's not practical (nor in
actual practice necessary) to test for the existence of every possible
feature every time the shell starts up. Run "make check" in the zsh
build tree for an idea of how long it takes to test a large number of
features even when each of them takes trivial time to test.
} Nonetheless, I guess I don't have some easy-peasy way to add the
} feature detection to the case statement in Src/hist.c and a new
} parameter in Src/Modules/parameter.c
I think you're holding zsh to a rather more detailed standard than
vim if you think zsh ought to provide a compiled-in self-test for
every syntactic nit. :-) However, no-prize to you if you can even
come up with a naming convention that would cover everything that
might need to be tested.
Messages sorted by: