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

Re: This widget implementation feels a bit clunky (edit-quoted-word)



On Sat, Jun 20, 2015 at 7:06 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sat, 20 Jun 2015 11:16:20 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> I feel like it's unnecessarily hard to get the resulting text from a
>> narrow-to-region session.
>
> Would you want something like this?

That does look very promising, yeah. :)
I suppose I should volunteer for writing the doc patch for this.

On Sat, Jun 20, 2015 at 7:21 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jun 20, 11:16am, Mikael Magnusson wrote:
> }
> } I feel like it's unnecessarily hard to get the resulting text from a
> } narrow-to-region session.
>
> Hmm.  If you used "narrow-to-region -S state ..." then I think the
> resulting text would be $BUFFER between the exit from recursive-edit
> and the call to "narrow-to-region -R state" ?
>
> Except that I'm having a little trouble with -S / -R.  The value of
> $MARK never seems to be correctly restored.  Is it supposed to be?

I'll admit I didn't actually look at the impl of the widget, only the
documentation.

> } It would be nice if quote-region let you specify the type of quoting.
> } Urk?
>
> The difficulty there is that it's a widget so there's no direct way to
> pass the type of quote.  I suppose you could use $NUMERIC.

I thought widgets can take an arbitrary amount of arguments, although
it is true that almost none do. The newly added bracketed-paste takes
an argument that names the parameter to store pasted text in for
example. If you mean that you can't do it directly via bindkey then
yeah, that's true, you'd still need a wrapper widget. For my use-case
I could put the argument right in with the zle call though. (But with
PWS' suggested change, I can just insert (q-)LBUFFER/RBUFFER directly,
I think).

-- 
Mikael Magnusson



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