I always delete more cells than I want to. This is because every time I choose the cells, I am not looking at the corresponding code belonging to that cell bracket (why? because Mathematica doesn't highlight what I am selecting). When you have multiple lines of code (single-celled) and you want to delete some at a stretch, you may accidentally delete one which you dint want to.

Is there an option in v.11 ? Or is this a feature that must be requested. Irrespective of all these, this should be a default feature.

1 Highlights cell brackets, but not cell: 1 2 Different FONT STYLE with cut+paste on same notebook enter image description here

  • 1
    $\begingroup$ If you select a cell bracket, the correspond code contained within the cell bracket must be highlighted. This will visually help the user to understand what section of code is selected. $\endgroup$ – Rene Duchamp Jun 14 '17 at 15:05
  • $\begingroup$ See my answer to How to highlight the whole selected cell. All you need to do is to change Background to FontColor, and change colors. $\endgroup$ – Carl Woll Aug 27 '17 at 8:32

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 =
With[{defStyles = 
     FrontEnd`FindFileOnPath["Default.nb", "StyleSheetPath"]},
  CopyFile[defStyles, $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:

 Hue[.6, .05, 1],

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.


FontColor -> 
 Dynamic[If[MemberQ[SelectedCells[], EvaluationCell[]], Blue, 

To the cell using Command-Shift-E (on Mac) or Cell > Show Expression

Then restart and you have your change.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.