From ac0b03f59ad06be0904a2d40f49de5ccb884bcfc Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Sat, 24 Dec 2016 15:59:40 -0500 Subject: [PATCH] Little bit cleaner method of calling add-zle-hook-widget with no_unset. --- zsh-syntax-highlighting.zsh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/zsh-syntax-highlighting.zsh b/zsh-syntax-highlighting.zsh index 5d941a1..fe3d53f 100644 --- a/zsh-syntax-highlighting.zsh +++ b/zsh-syntax-highlighting.zsh @@ -308,16 +308,13 @@ then } _zsh_highlight_bind_widgets(){} - local prevunsetstate= - [[ -o unset ]] || prevunsetstate=NO_ - setopt localoptions UNSET # for following two add-zle-hook-widget calls... - # TODO: figure out why only 5.3 with no_unset gives following error - # add-zle-hook-widget:84: widgets[$hook]: parameter not set - - add-zle-hook-widget zle-line-pre-redraw _zsh_highlight - add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish - - setopt ${prevunsetstate}UNSET # put back as before + # This is for 5.3 before about 5.3.2, or whenever add-zle-hook-widget + # in zsh source is modified to work with nounset in the calling scope. + () { + setopt localoptions UNSET + add-zle-hook-widget zle-line-pre-redraw _zsh_highlight + add-zle-hook-widget zle-line-finish _zsh_highlight__zle-line-finish + } else # Rebind all ZLE widgets to make them invoke _zsh_highlights. _zsh_highlight_bind_widgets()