From: Vincent Bernat <bernat@luffy.cx>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Magic URL quoting and bracketed paste gets "disabled" randomly
Date: Sun, 10 Jul 2022 21:12:36 +0200 [thread overview]
Message-ID: <60ccb13a-447a-09b7-3626-4948487e3ae4@luffy.cx> (raw)
In-Reply-To: <CAH+w=7am7ABpbJ_S1jBesEyw5opV+ezrZ83zCWU4_in-diC2Qg@mail.gmail.com>
On 2022-07-10 19:44, Bart Schaefer 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.
I am adding it to ZSH_AUTOSUGGEST_CLEAR_WIDGETS. I suppose I didn't want
the last suggestion to be kept after pasting.
>> 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".
Meantime, I am just wrapping it:
autoload -Uz url-quote-magic
function _vbe-url-quote-magic() {
emulate -L zsh
url-quote-magic "$@"
}
zle -N self-insert _vbe-url-quote-magic
> That said, I also can't think of any
> contributed function that intentionally defends itself against pattern
> disables.
It's a wonder I am not running into such issues more often. I'll just
disable extendedglob as I am only interested into the negative pattern
and I don't use it that often.
prev parent reply other threads:[~2022-07-10 19:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 6:13 Vincent Bernat
2022-07-09 3:10 ` Bart Schaefer
2022-07-09 5:40 ` Vincent Bernat
2022-07-10 17:44 ` Bart Schaefer
2022-07-10 19:12 ` Vincent Bernat [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60ccb13a-447a-09b7-3626-4948487e3ae4@luffy.cx \
--to=bernat@luffy.cx \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).