Thursday, April 11, 2013

Re: unlet-ing variables in buffers?

Hi LCD!

On Do, 11 Apr 2013, LCD 47 wrote:

> On 11 April 2013, Christian Brabandt <cblists@256bit.org> wrote:
> > Hi LCD!
> >
> > On Do, 11 Apr 2013, LCD 47 wrote:
> >
> > > On 10 April 2013, Christian Brabandt <cblists@256bit.org> wrote:
> > > > Hi LCD!
> > >
> > > Hi!
> > >
> > > > On Mi, 10 Apr 2013, LCD 47 wrote:
> > > >
> > > > > Variables local to (non-current) buffers can be read with
> > > > > getbufvar() and written with setbufvar(). Is there a way to delete
> > > > > variables from buffers? That is, is there a moral equivalent of
> > > > > "unlet b:var" for non-current buffers?
> > > >
> > > > I think, since you only get references to variables when using
> > > > getbufvar() you can simply modify the returned b: dict
> > > >
> > > > :call setbufvar(1, 'foobar', 2)
> > > > :let var=getbufvar(1, '')
> > > > :call filter(var, 'v:key != ''foobar''')
> > > > :echo getbufvar(1, 'foobar')
> > >
> > > Hmm, interesting idea, but "var" is locked:
> > >
> > > E741: Value is locked: filter() argument
> >
> > did you lock it? It worked for me with some test variable.
>
> I didn't, but in my test buffer 1 is hidden, and a buffer 2 is
> current (that's the case I care for).

That is probably the reason, the variable is locked, because the buffer
is hidden.

regards,
Christian
--
Flugzeug an Tower, Flugzeug an Tower: "Wir sind 1000 km von der Küste
entfernt und haben keinen Tropfen Sprit mehr im Tank. Was sollen wir tun?
Tower an Flugzeug: "Bitte sprechen sie mir nach: Vater unser, der du bist ..."

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: