Where does Scrivener save the current undo state?

I would like to export and save Scrivener’s “undo file” (or whatever it is called). Where do I find it?

That’s probably the key thing there. How would you describe, in more than a word or two, what it is you are looking for—if at least in terms of capability, or perhaps comparison to a similar capability in another program?

1 Like

Most software, including Scrivener, offers the option to “undo” a certain number of operations or work steps. For example, in Scrivener, when I write or delete or edit something, I can undo what I have written, deleted, or edited, pressing ⌘ and Z. For this to work, the previous states of the document are recorded by the UndoManger of macOS.

My question is, where are the previous states of the document (properly called the “registered undo operations” or “undo stack”) recorded and how can I save them to an external file.

Please note that this is not a feature request, although I believe it would be a powerful functionality, helping authors verify that they, and not someone else or an AI, have written their text. I’m not aware that an easy export function for the registered undo operations is implemented in any other writing software.

This function does not exist in Scrivener either.

However, if the goal is to provide a history to demonstrate your own authorship of the work, you might find the Snapshot and Backup functions useful.

I know that a function to export the undo stack isn’t implemented in Scrivener. But the undo stack exists. My question is: Where?

The Undo stack exists in memory while Scrivener is running. It is not persistent across sessions.

Just so I understand correctly: There is no temporary file, it’s all in RAM. Correct?

That would be a question for the developer. I’m not familiar with Scrivener’s operations at that level.

But there is no file that persists after Scrivener is closed.

Of course not. The undo stack is deleted when the app is closed. I would have to read it while Scrivener is still open.

Then I can only hope that Keith chimes in and answers my question.

By the way, Photoshop allows to save the edit history of a file either to an external text file or to the metadata of the image file itself. If you save the history to the image file, you can digitally sign the log file for legal purposes. See: Undo/redo and history in Adobe Photoshop (section " Set Edit History Log options").

You can read the documentation for NSUndoManager on Apple’s developer resources page. There appear to be no public methods that would facilitate long-term persistence.