[Openmcl-devel] What goes on under the hood during revert

Gary Byers gb at clozure.com
Mon Jan 25 02:02:57 PST 2010

On Sun, 24 Jan 2010, Ron Garret wrote:

> Trying to trace through the process of what happens when you revert a document...
> The REVERT menu item invokes revertDocumentToSaved: (as can be
> determined with this handy-dandy little snippet): >

> ? (%get-cstring (#_sel_getName (menu-item-action-selector "File"
> "Revert"))) "revertDocumentToSaved:"
> As far as I can tell, this method is not overridden anywhere in the
> GUI sources, so this just does the standard Cocoa thing, namely,
> displays the "Are you sure?" dialog, and then invokes....
> ... and that's where I get very puzzled, because the latest docs say
> it invokes revertToContentsOfURL:ofType:error:, which is also, as
> far as I can tell, not overridden anywhere.  What *is* overridden is
> revertToSavedFromFile:ofType: but that method is deprecated in
> Leopard, and as far as I can tell (by adding a print statement) this
> method is in fact not invoked when a file is reverted.

It is in fact invoked.  (I added a  (print "Reverting!") call in the method
body and when I reverted a document in the standalone IDE, that output went
to the AltConsole window.  I don't know why something similar didn't happen
in your case.)

(And this and other deprecated methods that operate on filenames
specified as strings should be replaced with more modern variants that
operate on file:// URLs and have a standard way of reporting errors.)

More information about the Openmcl-devel mailing list