driver: Use idiomatic module check

This commit is contained in:
Matthew Martin 2018-01-08 12:35:45 -06:00
parent d0fb0df4ff
commit f265ef0b9a

View file

@ -51,12 +51,10 @@ fi
# This function takes a single argument F and returns True iff F is an autoload stub.
_zsh_highlight__function_is_autoload_stub_p() {
if (( ${+functions} )); then
## zsh/parameter is available
if zmodload -e zsh/parameter; then
#(( ${+functions[$1]} )) &&
[[ "$functions[$1]" == *"builtin autoload -X" ]]
else
## zsh/parameter isn't available
#[[ $(type -wa -- "$1") == *'function'* ]] &&
[[ "${${(@f)"$(which -- "$1")"}[2]}" == $'\t'$histchars[3]' undefined' ]]
fi
@ -65,11 +63,9 @@ _zsh_highlight__function_is_autoload_stub_p() {
# Return True iff the argument denotes a function name.
_zsh_highlight__is_function_p() {
if (( ${+functions} )); then
## zsh/parameter is available
if zmodload -e zsh/parameter; then
(( ${+functions[$1]} ))
else
## zsh/parameter isn't available
[[ $(type -wa -- "$1") == *'function'* ]]
fi
}