At the time this question was asked, version 10 was not out yet. The Front End of Mathematica 10 does have multiple undo, see the answer by John Fultz.

The Mathematica Front End's built-in Undo command can only undo a single editing step.

Has anyone implemented or seen implemented an efficient and comfortable multiple undo?

I have in mind ideas such as, CellEventActions that keeps a stack in the cell context pushing the cell state every time a key among a list (brackets, @, operators) is pressed. Some other shortcut to recover older states (or a palette, or perhaps tweaking the front end's .tr files??)

I am not familiar at all with typical text based implementations and their issues. I guess it wouldn't be a practical problem to lose the undo state between sessions, would it?

So, has this been done, or is it doable or practical? What are your thoughts?

  • 5
    $\begingroup$ This certainly seems possible at least for the "Program" - style cells, and I have plans to integrate this as a feature in the next versions of the syntax highlighter, which you are probably familiar with. Since my highlighting engine is grabbing the cell's contents on every trigered event, this should be a relatively simple matter to do. One problem I face here is that I don't know how to trigger the CTRL key (or its equivalent on other platforms) yet. $\endgroup$ Commented Feb 18, 2012 at 21:41
  • 1
    $\begingroup$ @LeonidShifrin I would happily write Undo[] multiple times, don't let Ctrl get in your way. $\endgroup$
    – David
    Commented Mar 6, 2012 at 7:35
  • 15
    $\begingroup$ I can't undertand. Why Mathematica is missing this? This action is extremly needed and useful. And missing until latest Mathematica versions. Lol. Why? Maybe someone should contact Mathematica and show this question for them. $\endgroup$
    – GarouDan
    Commented Jun 26, 2012 at 19:03
  • 2
    $\begingroup$ undo-for-mathematica.alaifari.com $\endgroup$
    – Tyilo
    Commented Aug 24, 2013 at 22:45
  • 2
    $\begingroup$ Now that Mathematica 10 has been released, note that among new features is: "Computation-aware multiple undo The problem of multiple undo in Mathematica has been solved!". See wolfram.com/mathematica/new-in-10/for-existing-users. $\endgroup$
    – murray
    Commented Jul 9, 2014 at 18:57

2 Answers 2


I implemented a multiple undo mechanism in v10.

It's not as perfect as I would like it to be, yet, but it does a pretty decent job in my experience. And a few of the documented options for it got ahead of the implementation...think of some of that stuff as a "coming soon".

Feel free to ping me on any problems you find with it.

Edit: In 10.0.2, all of the documented options are implemented except for "SpoolDirectory".

  • $\begingroup$ How perfect would you like it to be? As in what specific elements would you have liked it to have? $\endgroup$
    – jVincent
    Commented Jul 13, 2014 at 20:23
  • $\begingroup$ @jVincent Speaking as someone who had to think about every aspect of the system, I'm always seeing lots of bugs and limitations, many of which might be rarely noticed outside of Wolfram. In some cases, things that should be undoable but aren't. In some cases, undo falls over and does the wrong thing (I have significant internal consistency checks that tend to prevent undo from causing harm, but it will stop and wipe the undo stack in such a case). But my own priority/embarrassment list might not match those found by users. So, we'll see what the community judgment is. :) $\endgroup$
    – John Fultz
    Commented Jul 15, 2014 at 17:34
  • 2
    $\begingroup$ Awesome! First complaint: I should be able to hold down ⌘Z or ⇧⌘Z and have it repeatedly undo/redo :) $\endgroup$
    – jtbandes
    Commented Jul 17, 2014 at 8:00
  • $\begingroup$ @jtbandes Thanks for the complaint (really!)...that's a pretty decent suggestion. It's odd that I've never tried that before despite the fact that I commonly do it in text editors. $\endgroup$
    – John Fultz
    Commented Jul 28, 2014 at 0:57
  • $\begingroup$ Can you please take a look at this? It seems to be a bug in the undo feature (confirmed by Rolf). I'm just posting that here since you implemented the feature :) $\endgroup$
    – Öskå
    Commented Jan 16, 2015 at 19:46

I made a simple version control and undo function. (Since it uses system commands right now it is only tested for Linux. Windows support is added but not tested. MacOS is not tested either.)

Here is the link to undo.m or the github if you just want to try it (and trust me enough to run the code without checking) run


Would be great to have some feedback with ideas how to improve it, also I didn't test this a lot but it seems to be working fine. It is probably not the most efficient way but I think it is a good start.

From the readme:

This package adds a poor mans version control and undo functionality to Mathematica. For a previously saved notebook 'notebook.nb' a version info file 'notebook.nb.undo.mx' is created and every time changes are committed a backup file 'notebook.nb[version].bak' is created. System menu entries in insert are created.

Keyboard Shortcuts

Alt+z : Undo

Alt+x : Redo

Alt+s : Commit

Alt+d : Opens CommitInfo Dialog

Usage: Evaluate the following commands

ManualCommit (Default) - Only do commits manually.

AutoCommit - Turn on automatic commits. Every time a cell is evaluated a new commit is made. (This can lead to a lot of files)

CronCommit[n] - makes a new commit every n minutes.

CommitNow - Making a commit CommitInfo - Show a list of all Versions CommitClean - Remove all commited files

Undo - Undo to the previous commit Redo - Undo to the next commit GotoCommit[n] - Go to the n-th version


When altering not the latest version, the changes (when running undo or redo) are not saved, only when running 'commit' these changes are changed (with a new highest version number). Only changes to the version with the highest version number are changed upon 'undo'

Whether a commit needs to be made when running undo is checked with a system variable that can be altered by manually saving the document. Leading to possible loss of changes. For best results do not save the notebook manually and turn auto save off - just use commit to save the work.

EDIT: This version also has problems with individual context for each notebook, so just be warned. :)

  • $\begingroup$ thanks to Chris Degnen for helping with the keyboard shortcuts. mathematica.stackexchange.com/questions/16165/… $\endgroup$
    – jens_bo
    Commented Dec 12, 2012 at 16:04
  • $\begingroup$ from looking at the code, it should work under OS X (the default shell is bash) $\endgroup$
    – acl
    Commented Dec 12, 2012 at 22:48

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