Re: [rant] Should reverting a buffer really discard undo history?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [rant] Should reverting a buffer really discard undo history?

Richard Stallman
    I'm not real familiar with the mechanics of the undo list, but couldn't the
    previous file contents be stored only on disk, as a temporary file, and the
    value in the undo list be just a pointer to that file instead of the file
    contents?

It would be conceivable to store old undo-list contents in files.  15
years ago I wanted to implement that in Emacs.  Nowadays it seems less
important, because memory is big enough to hold more undo list data
than in the past.  It's only for something like this that one would
think of wanting to do that.


_______________________________________________
Emacs-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/emacs-devel
Reply | Threaded
Open this post in threaded view
|

Re: [rant] Should reverting a buffer really discard undo history?

Bugzilla from dann@ics.uci.edu
Stefan Monnier <[hidden email]> writes:

  > > My ~/.emacs would have been saved had Emacs kept the buffer contents
  > > in undo history when reverting the file.  I'd like to if there is any
  > > way to enable this, and (if so) why Emacs does not do it by default.
  >
  > I have locally patched my Emacs to preserve undo info during revert, so
  > I completely agree it's desirable.  When I suggested the change it was
  > rejected (it's somewhere in the archive if you're interested, tho I can't
  > remember the thread title and not even when it took place, I'd say about
  > 2 years ago).
  >
  > Maybe having it as a (potentially buffer-local) option is a good idea.
  >
  > What do people think?

It would be nice.

Maybe other users have a different experience, but for me 99% of the
time I would like undo info after a revert is when revert was invoked
by VC/pcl-cvs after a commit.
So from this users point of view if VC/pcl-cvs were not to revert the
buffer, saving undo after revert would not be missed much.

        --dan


_______________________________________________
Emacs-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/emacs-devel
Reply | Threaded
Open this post in threaded view
|

Re: [rant] Should reverting a buffer really discard undo history?

Stefan Monnier
> Maybe other users have a different experience, but for me 99% of the
> time I would like undo info after a revert is when revert was invoked
> by VC/pcl-cvs after a commit.
> So from this users point of view if VC/pcl-cvs were not to revert the
> buffer, saving undo after revert would not be missed much.

Indeed, it may also be useful to allow the revert-undoability to be
specified on a revert-by-revert basis.  And VC/PCL-CVS would be well served
by a "revert carefully" which would do something like "diff+patch" rather
than an actual revert.  Note that revert already does a limited form of
diff+patch since it checks the prefix&suffix of the file/buffer which hasn't
changed, so if only one line was changed the undo would record only
a one-line change rather than a complete delete+insert of the whole buffer.


        Stefan


_______________________________________________
Emacs-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/emacs-devel
Reply | Threaded
Open this post in threaded view
|

Re: [rant] Should reverting a buffer really discard undo history?

Bugzilla from dann@ics.uci.edu
Stefan Monnier <[hidden email]> writes:

  > > Maybe other users have a different experience, but for me 99% of the
  > > time I would like undo info after a revert is when revert was invoked
  > > by VC/pcl-cvs after a commit.
  > > So from this users point of view if VC/pcl-cvs were not to revert the
  > > buffer, saving undo after revert would not be missed much.
  >
  > Indeed, it may also be useful to allow the revert-undoability to be
  > specified on a revert-by-revert basis.  And VC/PCL-CVS would be well served
  > by a "revert carefully" which would do something like "diff+patch" rather
  > than an actual revert.  Note that revert already does a limited form of
  > diff+patch since it checks the prefix&suffix of the file/buffer which hasn't
  > changed, so if only one line was changed the undo would record only
  > a one-line change rather than a complete delete+insert of the whole buffer.

If saving undo after revert is not implemented/accepted would it be
possible to avoid the revert if it is not needed after a commit?
Wouldn't a (string= (md5 FILE) (md5 BUFFER)) be enough to avoid
reverting?


_______________________________________________
Emacs-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/emacs-devel
Reply | Threaded
Open this post in threaded view
|

Re: [rant] Should reverting a buffer really discard undo history?

Richard Stallman
    If saving undo after revert is not implemented/accepted would it be
    possible to avoid the revert if it is not needed after a commit?
    Wouldn't a (string= (md5 FILE) (md5 BUFFER)) be enough to avoid
    reverting?

That sounds like a good idea.


_______________________________________________
Emacs-devel mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/emacs-devel