Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:date:message-id:subject:from:to
         :cc;
        bh=xnYyXAFX3xAB9EmK48UIRGvYimv4Yu9lIPiMCN31u4k=;
        b=LftQhzBvtdn0jp6AtX8LJdwjKljii6irGcRTryPGcBsnLRntz+JxIkUniugeuP/Mfl
         5HljOigHWg3y6CgjxEyzQAOESl3fzTq1aAKByJ/GG1YRUeX1Z5q4oPIjEoVegUh9C4rd
         UOdKR0UaeZWti59t5Igxi/+W8y4POpNyaVpAWG8bxlcmgPSbz/s8lT2/P4iirsqTHc79
         dqpnR4LsNtLSUiiY/NT0yHuh28PzDLMQ8nJFxmtgfkls+bqcY87LzND5Xou2v8caQHFv
         G/xTzyVvGaIX8Jvg6WVZ5O+/5l2qQP2c8qXGDcp6RJdu5CPwiM8sjPc9VTOoFaqxEjEV
         OdOA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:cc;
        bh=xnYyXAFX3xAB9EmK48UIRGvYimv4Yu9lIPiMCN31u4k=;
        b=cqTWg03yWxtXhaZIno0Gimor322UX7mjFD4E/Th57pP8WtIRcHn337Y2HUVQoegbNT
         j4s/rQBoQov6iKLJKB78+yPgciN4AtdqH2oozvlxWkvwsfPLxsVjJds7mXr/Io0Y0v20
         PM+imb6cw7f8iTI3yPDS2vv8WIR8jcahTX3fzZYrmxvh8cv/NNiMh+kwgV5TPuP4mman
         bXu/h8CefXd/mMGU1TeuOmhDB+cZ809OZrs2PvU+tgnp9hKau2bvgm4EHsdxsNJVoYc1
         wj/r3TzR8ewuJvywWt8VjYtXC9KJlxnowK811zTDWp73gjC4GgTUKxgHgRolprcuZCAu
         t1NQ==
X-Gm-Message-State: AOPr4FXjguXUdVisGpy5AfiA9binVHIZLW/rBLZLuj5DxDdmCtfuhpbrTFl0F6Z4+U0lnJ7rQBP0kRhI3BKoNw==
MIME-Version: 1.0
X-Received: by 10.55.47.70 with SMTP id v67mr18855919qkh.135.1463189627047;
 Fri, 13 May 2016 18:33:47 -0700 (PDT)
In-Reply-To: <20160513222039.GA2425@tarsus.local2>
References: <20160506205309.GY5029@sym.noone.org>
	<160508115026.ZM10022@torch.brasslantern.com>
	<20160509141306.GA18211@cventin.lip.ens-lyon.fr>
	<160509084143.ZM13554@torch.brasslantern.com>
	<20160510085833.GA20332@cventin.lip.ens-lyon.fr>
	<160510125848.ZM1686@torch.brasslantern.com>
	<20160513092348.GB18186@zira.vinc17.org>
	<CAH+w=7YYkto7u1WNcfmTs30o1wVGF4VRwnKmJtFz=5K4iLLp5A@mail.gmail.com>
	<20160513222039.GA2425@tarsus.local2>
Date: Sat, 14 May 2016 03:33:46 +0200
Message-ID: <CAHYJk3S9qPhCByg8T-mrRjgUNBs-ubFCGKDKT7qx9=yGepA8qg@mail.gmail.com>
Subject: Re: bracket-paste-magic adds backslashes inside a quoted string if
 URL is pasted ("regression" compared to pre-5.1 url-quote-magic)
From: Mikael Magnusson <mikachu@gmail.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 38488

On Sat, May 14, 2016 at 12:20 AM, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Bart Schaefer wrote on Fri, May 13, 2016 at 04:06:45 -0700:
>> Stepping outside the box a little here -- when url-quote-magic was
>> written there was no such thing as the zle-line-pre-redraw hook.  It
>> might be that a better approach would be to examine the entire buffer
>> in that hook after the paste has finished and apply the quoting
>> retroactively, rather than to do it character by character during the
>> paste.  (On the other hand zle-line-pre-redraw is thoroughly co-opted
>> by popular plugins like zsh-syntax-highlighting.)
>
> So perhaps it's time to permit registering multiple functions to be
> invoked at pre-redraw, as proposed in 37639?  This way, z-sy-h and
> url-quote-magic could each register a pre-redraw hook function.
>
> zle-line-pre-redraw has not yet been released: its interface can be
> changed arbitrarily.  z-sy-h will be updated to use whatever interface
> zsh-5.3 will be released with.

It's already possible to do

zle-line-pre-redraw() {
  whatever code
  other code
  z-sy-h-hook
  yet more code
}

Surely there has to be some limit to how lazy a user can be?

Also, if multiple things register for this automatically, it feels
pretty likely more than one of them will be trying to do highlighting
and then things will be wonky. And if you modify the buffer in one of
them like in the GP example, the order _definitely_ matters or you
will have highlights in the wrong place, so the user will have to
intervene in that case. If "plugins" are automatically registering
your more generic hook interface, it is very difficult for the user to
arrange for the order to be correct.

This has a weak NAK from me.

-- 
Mikael Magnusson

