11
$\begingroup$

Although Undo has been around since version 10 (before my time) I've noticed that sometimes it works just fine up to the moment of the last Save. At other times it only works a few steps back. Then there are times when I type several characters (let's call it a dozen or more) into a cell not yet doing a Shift-Enter and it will only step back about half the characters far short of what I typed since the start of editing step. Either I am doing something that corrupts Undo or it is a buggy implementation.

For context I am a beginner (9 months). I am not doing anything advanced like programmatically creating new cells or notebooks, working with multiple connected workbooks, or streaming external data sources. I do not place individual statements into their own cells. Instead I place multiple related statements in a single context such as modules, blocks, functions, etc. within a single cell. I also place multiple modules, blocks, and functions into a single cell.

I often forget to save my work so I can go for an hour or more without saving or clearing anything from memory or at other times I might save after only a few edits but the Undo behavior remains sporadic.

I sometimes place Clear["Global*"] or ClearAll["Global*"] at the very top of an open notebook (for a fresh start) and almost always do an Evaluate Notebook instead of Shift-Enter. Could this be corrupting my Undo? Needless to say I am not working on a major projects just simple widget-like applications. Most of it is just mathematical calculations with finely tuned output structures for presentation.

My settings for Undo are enabled with Infinite steps. What could possibly be going wrong? Please help.

$\endgroup$
7
  • 5
    $\begingroup$ This is something I've also seen. I think it has to do with how Mathematica manages the spool of previous changes. It seems to have a relatively aggressive strategy for clearing that cache (which is maybe good because I've had Undo give me disastrous results when I try to make it do too much). Sadly I don't know how to make it be less aggressive on that. $\endgroup$
    – b3m2a1
    Oct 9, 2020 at 6:29
  • 5
    $\begingroup$ It seems that every single app i have used since the 1980's has had a robust multiple undo capabilities some even with a drop down menu for selecting from a a list of previous edits. this includes apps from MS Office to code editors to CAD like SolidWorks and CATIA and other engineering apps but not mathematica. that is too bad because it likely has the best symbolic algebra engine on the planet. $\endgroup$ Oct 9, 2020 at 6:52
  • 1
    $\begingroup$ I never use the Evaluate Notebook notebook function myself, but I can imagine that using it would make it a lot more difficult for the FE to undo things because of the number of things happening. You may want to consider moving to a workflow using package files to hold the bulk of your code and re-loading those packages instead of re-evaluating notebooks. $\endgroup$ Oct 9, 2020 at 11:35
  • 3
    $\begingroup$ Related: mathematica.stackexchange.com/questions/1953/… -- John Fultz at WRI lead the implementation. He invites feedback in his answer. I would email Wolfram Support, reference this SE post, and hope it comes to Fultz's attention. I'd also leave a comment on his answer. He checks in here on Mma.SE from time to time but not every day or even every week, I think. $\endgroup$
    – Michael E2
    Oct 9, 2020 at 13:51
  • 3
    $\begingroup$ I've also observed this behavior, although I don't really know how to trigger it. In general, I would have preferred a less fancy undo (i.e. no rewinding of kernel evaluations) that is 100% reliable when recovering expressions entered in the front-end. It happened to me multiple times that I accidentally deleted an important piece of code, but the undo could not recover it for me and so it was lost. This is also one of the reasons why I prefer programming my packages in Wolfram Workbench as compared to the front-end. $\endgroup$
    – vsht
    Oct 11, 2020 at 16:24

0

Your Answer

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