Hi LCD! On Do, 11 Apr 2013, LCD 47 wrote:
> On 10 April 2013, Christian Brabandt <[email protected]> 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. > Is it safe / sane to unlock it? I don't know. This depends on what locked it, I guess. > Also, I presume Vim maintains reference counts and the like for > garbage collection, would this kind of manipulation do the right > adjustments? Don't know. regards, Christian -- Selbst eine gute Ehe ist Bußzeit. -- Russisches Sprichwort -- -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
