note
premchai21
<p>Could you have an on-buffer-change hook of some sort that accesses a data structure keeping track of which variables were buffer-local to which buffers and swaps their values in and out appropriately?</p>
<p>That is, something like (quite untested):</p>
<code>
sub onBufferChange
{
my ($from, $to) = @_;
for my $scl (values $from->{locals}) {
$$$scl[0] = $globalLocals{$$scl[0]}[1];
}
for my $scl (values $to->{locals}) {
exists $globalLocals{$$scl[0]} or
$globalLocals{$$scl[0]} = [$$scl[0], $$$scl[0]];
$$$scl[0] = $$scl[1];
}
}
</code>
<p>I have the feeling I've missed the point...</p>
246504
246504