Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] correced example in zle doc



On 13 September 2014 14:41, Manuel Presnitz <mpy@xxxxxxx> wrote:
> Hi,
>
> the given example in the zshzle man page does not follow the suggestion to check substrings in $ZLE_STATE in alphabetically order. (For reference: The alphabetically sorting was introduced in 30425.)
>
>> The substrings are sorted in alphabetical order so that if you want to test for two specific
>> substrings in a future-proof way, you can do match by doing:
>>
>>   if [[ $ZLE_STATE == *insert*globalhistory* ]]; then ...; fi
>
>
> With the attached path the example works now as intended; credit for discovering that bug in the doc goes to Volker Siegel (http://superuser.com/questions/691925/zsh-how-to-zle-widgets-directly/691935#comment1060599_691935).
>
> ---Manuel.
>
>
>
> diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
> index 2a907c5..e586536 100644
> --- a/Doc/Zsh/zle.yo
> +++ b/Doc/Zsh/zle.yo
> @@ -948,7 +948,7 @@ The substrings are sorted in alphabetical order so that if you want to
>  test for two specific substrings in a future-proof way, you can do match
>  by doing:
>
> -example(if [[ $ZLE_STATE == *insert*globalhistory* ]]; then ...; fi)
> +example(if [[ $ZLE_STATE == *globalhistory*insert* ]]; then ...; fi)
>  )
>  enditem()

We could use *insert*~^*globalhistory* here and it would work in any
order (needs extendedglob set, but you can always enable it in a
widget function locally anyway).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author