## Context "Unique to This Notebook" makes variables black even if they're not defined?

7

1

I'm trying to use this technique to keep variables separated between different notebooks. It seems to be working fine, except that variables turn black as soon as they are evaluated — any ideas why this would be happening? Here are some examples:

And with a variable that hasn't been used at all:

Suddenly it's black, even though it has no value:

@Kuba That's probably best. Do you care to post it? – Mr.Wizard – 2015-02-17T17:56:20.997

I don't have time to tinker with this, but I think it could be addressed by setting one of the different styling options in Options[\$FrontEnd, AutoStyleOptions] (also see in the options inspector) – rm -rf – 2012-10-26T20:13:09.733

1So this is a different solution to the problem of different notebooks/different contexts. What about using different kernels? You can add more kernels by going to the Evaluation menu and selecting Kernel Configuration Options. I have multiple local kernels that I'll use for just this reason. – None – 2012-10-26T21:08:20.777

Behavior confirmed in version 7 on Windows 7. – Mr.Wizard – 2013-05-23T14:27:38.910

5I'm reasonably certain this is designed behavior - the variable coloring is only supposed to apply to the Global context. As an indication, in Preferences>Appearance>Syntax Coloring>Other the typical blue color is assigned to "Global symbols that have no value assigned". I'm not aware of any way of getting the syntax coloring to look at symbols in other contexts here, but maybe there is some trick. – KAI – 2013-05-23T17:49:51.030

@KAI please consider submitting that as an answer. – Mr.Wizard – 2013-05-29T06:22:35.640

I'm reasonably certain this is designed behavior - the variable coloring is only supposed to apply to the Global context.
As an indication, in Preferences>Appearance>Syntax Coloring>Other the typical blue color is assigned to "Global symbols that have no value assigned"`. I'm not aware of any way of getting the syntax coloring to look at symbols in other contexts here, but maybe there is some trick.