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

Re: Magic URL quoting and bracketed paste gets "disabled" randomly

On Fri, Jul 8, 2022 at 10:40 PM Vincent Bernat <bernat@xxxxxxxx> wrote:
> I am using autosuggest, so I get:
> zle -N bracketed-paste _zsh_autosuggest_bound_1_bracketed-paste

I can't think of any reason autosuggest would need to rebind that widget.

> It seems the condition if [[ "$words[-1]" == (#b)([^:]##):* ]] does not
> match. I am using "disable -p #" which seems to be the cause. Using
> "emulate -L zsh" at the top of the function instead of "setopt
> localoptions" fixes the issue. I though functions should use "emulate -L
> zsh" when using these options, but in Zsh codebase, "setopt
> localoptions" seems used often. Should any of this considered as a bug?

"emulate -L" potentially resets a lot of things.  The decision for
each function has to be whether the scope requires all those elements
to be reset, or whether to make minimal changes so as to behave as
much as possible like the rest of the user's environment.

In the case of url-quote-magic I can't presently think of any reason
not to use "emulate -L".  That said, I also can't think of any
contributed function that intentionally defends itself against pattern

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