So I disagree that this should be a default feature (I think it would interrupt my flow, at least). But it's not so tough to get this in as a default feature.
If you only want it to affect your notebooks going forward, you can make your own stylesheet where you implement this and then set:
CurrentValue[$FrontEndSession, DefaultStyleDefinitions]
to that stylesheet.
Alternatively we can take advantage of the fact that FrontEnd`FindFileOnPath
will scan $UserBaseDirectory
before the system dirs.
That means we can make a whole-sale copy of "Default.nb"
in the $UserBaseDirectory
and just muck-about with that:
$userBaseStyles =
FileNameJoin@{
$UserBaseDirectory,
"SystemFiles",
"FrontEnd",
"StyleSheets",
"Default.nb"
};
With[{defStyles =
FrontEndExecute@
FrontEnd`FindFileOnPath["Default.nb", "StyleSheetPath"]},
CopyFile[defStyles, $userBaseStyles]
];
SetOptions[
NotebookOpen[$userBaseStyles],
{
Editable -> True,
Saveable -> True
}
]
There should then be a way to add in your defintion. Here's a first guess, although it should be possible to do this with things in the FEPrivate`
context. (when I figure that out I'll post it)
Update: FEPrivate confusion
by what I know about the FEPrivate`
context this ought to be working:
FEPrivate`If[
FEPrivate`MemberQ[
FrontEnd`Cells[
FrontEnd`NotebookSelection[FrontEnd`InputNotebook[]]
],
FrontEnd`EvaluationCell[]
],
Hue[.6, .05, 1],
Inherited
]
But for reasons I don't understand it is not. Obviously it doesn't work with FE`Evaluate
, because neither FronEnd`Cells
nor FrontEnd`EvaluationCell
work with it, but I thought in the past it had resolved such things fine, anyway.
Original:
FontColor ->
Dynamic[If[MemberQ[SelectedCells[], EvaluationCell[]], Blue,
Inherited]]
To the cell using Command-Shift-E (on Mac) or Cell > Show Expression
Then restart and you have your change.