Having lost a few mins of inspired writing, I'm all for leaving the emergency files lying around... Best, -Jose
Jose Quesada, PhD. Research scientist, Max Planck Institute, Center for Adaptive Behavior and Cognition, Berlin http://www.josequesada.name/ http://twitter.com/Quesada On Mon, Oct 25, 2010 at 7:23 PM, John McCabe-Dansted <gma...@gmail.com>wrote: > On Tue, Oct 26, 2010 at 12:03 AM, Richard Heck <rgh...@comcast.net> wrote: > > I think this was added a while ago, because we were leaving emergency > files > > lying around. We only ask about this if an attempt to recover the file > has > > been made, either successfully or not. So either the document is now > loaded > > in the buffer or else we couldn't load it. > > Again, I'd personally put this in ::save(). Leaving an emergency file > around until the user next saves doesn't sound too bad to me. If > everything goes well the user will continue working on the file and > save it soon enough. If it doesn't go well, keeping the file around is > probably a good idea. (The user might not know whether everything will > go well at the point we ask them) > > >> Otherwise I'd add a "Keep All" option. > > > > What does this mean? > > Once you click "Keep All", we keep all the saves without prompting the > user. > > >> + e.checksum() != s.checksum()) { > >> > >> There are a number of ways to get a dirty buffer without actually > >> changing the file. E.g we can add two spaces that get converted to a > >> single space, or we can add a character and then remove it by > >> backspacing. This seems to happen fairly regularly to me, so it seems > >> worth checking for. > > > > I'm not sure where this code is. I'd want to see the context before > deciding > > whether this is worth it. > > It occurs immediately prior to prompting the user whether we want to > open the original or the emergency file. I consider it worthwhile > since even IO is cheap compared to user time (and user concentration). > > This is now like: > -------------- > Buffer::ReadStatus Buffer::readEmergency(FileName const & fn) > { > FileName const emergencyFile = getEmergencyFileNameFor(fn); > if (!emergencyFile.exists() > || emergencyFile.lastModified() <= fn.lastModified() || > + emergencyFile.checksum() == fn.checksum()) > return ReadFileNotFound; > > docstring const file = makeDisplayPath(fn.absFileName(), 20); > ---- > > (and similar for autosave files) > > >> This is the code for the "Recover All" emergency save. > > > > Can you redo this, separately, given the recent changes? > > Sure (attached), but note that without having an e.g. "Keep All" > option, if you open several files you'll still have several windows > popping up asking you if you want to keep the emergency saves. > > -- > John C. McCabe-Dansted >