Fix deprecation warnings.

This commit is contained in:
Eric Freese 2016-02-14 00:32:25 -07:00
parent ebcfc46b72
commit 9788c2ee49
3 changed files with 18 additions and 24 deletions

View file

@ -55,7 +55,7 @@ _zsh_autosuggest_bind_widgets() {
local widget; local widget;
# Find every widget we might want to bind and bind it appropriately # Find every widget we might want to bind and bind it appropriately
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|run-help|which-command|beep|set-local-history|yank)}; do for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|zle-line-*|run-help|which-command|beep|set-local-history|yank)}; do
if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then
_zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify _zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify
elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then

View file

@ -3,7 +3,9 @@
# Handle Deprecated Variables/Widgets # # Handle Deprecated Variables/Widgets #
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
unset _ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN _zsh_autosuggest_deprecated_warning() {
>&2 echo "zsh-autosuggestions: $@"
}
_zsh_autosuggest_check_deprecated_config() { _zsh_autosuggest_check_deprecated_config() {
if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then
@ -23,17 +25,12 @@ _zsh_autosuggest_check_deprecated_config() {
fi fi
} }
_zsh_autosuggest_deprecated_warning() {
>&2 echo "zsh-autosuggestions: $@"
}
_zsh_autosuggest_deprecated_start_widget() { _zsh_autosuggest_deprecated_start_widget() {
if [ -z "$_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN" ]; then _zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. For more info, see the README at https://github.com/tarruda/zsh-autosuggestions."
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. Use the autosuggest_start function instead. For more info, see README at https://github.com/tarruda/zsh-autosuggestions." zle -D autosuggest-start
_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN=true eval "zle-line-init() {
fi $(echo $functions[${widgets[zle-line-init]#*:}] | sed -e 's/zle autosuggest-start//g')
}"
autosuggest_start
} }
zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget

View file

@ -90,7 +90,9 @@ ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=(
# Handle Deprecated Variables/Widgets # # Handle Deprecated Variables/Widgets #
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
unset _ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN _zsh_autosuggest_deprecated_warning() {
>&2 echo "zsh-autosuggestions: $@"
}
_zsh_autosuggest_check_deprecated_config() { _zsh_autosuggest_check_deprecated_config() {
if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then
@ -110,17 +112,12 @@ _zsh_autosuggest_check_deprecated_config() {
fi fi
} }
_zsh_autosuggest_deprecated_warning() {
>&2 echo "zsh-autosuggestions: $@"
}
_zsh_autosuggest_deprecated_start_widget() { _zsh_autosuggest_deprecated_start_widget() {
if [ -z "$_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN" ]; then _zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. For more info, see the README at https://github.com/tarruda/zsh-autosuggestions."
_zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. Use the autosuggest_start function instead. For more info, see README at https://github.com/tarruda/zsh-autosuggestions." zle -D autosuggest-start
_ZSH_AUTOSUGGEST_DEPRECATED_START_WIDGET_WARNING_SHOWN=true eval "zle-line-init() {
fi $(echo $functions[${widgets[zle-line-init]#*:}] | sed -e 's/zle autosuggest-start//g')
}"
autosuggest_start
} }
zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget
@ -181,7 +178,7 @@ _zsh_autosuggest_bind_widgets() {
local widget; local widget;
# Find every widget we might want to bind and bind it appropriately # Find every widget we might want to bind and bind it appropriately
for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|run-help|which-command|beep|set-local-history|yank)}; do for widget in ${${(f)"$(builtin zle -la)"}:#(.*|_*|orig-*|autosuggest-*|$ZSH_AUTOSUGGEST_ORIGINAL_WIDGET_PREFIX*|zle-line-*|run-help|which-command|beep|set-local-history|yank)}; do
if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then if [ ${ZSH_AUTOSUGGEST_MODIFY_WIDGETS[(r)$widget]} ]; then
_zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify _zsh_autosuggest_bind_widget $widget _zsh_autosuggest_modify
elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then elif [ ${ZSH_AUTOSUGGEST_CLEAR_WIDGETS[(r)$widget]} ]; then