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