If I've written some code followed by a comment, like this:


and I remove the comment by first removing the right delimiter and then the left, my undo history is cleared. Here are some conditions for this to occur:

  • It doesn't matter whether I remove the * or the parentheses, or both

  • Some code must precede the comment. Brackets, semicolons and commas don't seem to count.

  • The comment cannot be empty.

Has anyone else experienced this? Is there a way to fix it?

I'm on 10.1, Student Edition.

  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented May 23, 2015 at 23:12
  • $\begingroup$ What, precisely, is the issue? $\endgroup$
    – bbgodfrey
    Commented May 23, 2015 at 23:16
  • $\begingroup$ It's right there in the title. $\endgroup$
    – H.v.M.
    Commented May 23, 2015 at 23:21
  • $\begingroup$ Can you post the output of $Version? $\endgroup$
    – Bichoy
    Commented May 23, 2015 at 23:54
  • $\begingroup$ "10.1.0 for Microsoft Windows (64-bit) (March 24, 2015)" $\endgroup$
    – H.v.M.
    Commented May 23, 2015 at 23:59

2 Answers 2


In an attempt to reproduce this issue, I began with

(* "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)

I then typed


and deleted by hand the left asterisk, right asterisk, left parenthesis, and right parenthesis in turn.


Next I began Edit>Undo until I reached

x (y*)

At that point, Undo was not grayed out, so the queue presumably was not empty. Nonetheless, the final Undo was greeted by a beep, and the final asterisk was not restored. Moreover, Undo became grayed out. Selecting Help>Why the Beep? returned the message, Cannot undo the last operation. So, I did not reproduce the issue given in the question, but I certainly obtained unexpected results.

On the other hand, when I deleted first the parentheses and then the asterisks in turn, I was able to restore all four characters using Edit>Undo.

  • $\begingroup$ By "second delimiter" I meant the right one. You have to remove either the right asterisk or parenthesis (or both), and then either the left asterisk or parenthesis (or both). I made some edits to OP to clarify. $\endgroup$
    – H.v.M.
    Commented May 24, 2015 at 11:30

If I use menu Edit > Un/Comment Selection (Windows: Alt+/) the operation can be reversed with the Undo command. This is faster anyway and prevents broken syntax and syntax highlighting that occurs when you remove half a comment marker.

(I post this as an answer because I hope it is pragmatically just that.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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