emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: *vc-diff* keeps undo information


From: Richard Stallman
Subject: Re: *vc-diff* keeps undo information
Date: Fri, 02 Jun 2006 18:39:04 -0400

Can someone call buffer-disable-undo in the *vc-diff* buffer
when it is created?


Date: Thu, 1 Jun 2006 17:31:19 -0400
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
From: Bob Rogers <address@hidden>
To: address@hidden
Subject: *vc-diff* keeps undo information
X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO 
        autolearn=failed version=3.0.4

   Primarily, the "undo" history consists of (erase-buffer) followed by
insertion of diff output.  Even emacs 21.3 allows me to undo/redo
through the complete "history" of diffs.  Is this a feature?!?

   I would argue the contrary.  Besides being wasteful of memory, other
"undo" behavior sometimes gets in the way.  Here's what happens if you
ever create a large diff:

   1.  "emacs -Q"

   2.  Visit a file under version control.

   3.  Make it some 3MB larger, possibly by inserting it into itself
repeatedly.  The goal is to make the resulting vc-diff buffer output at
least 3MB.

   3.  "C-x v =" to make the *vc-diff* buffer appear for the first time.

   4.  "C-x o C-x v =" to replace the *vc-diff* buffer contents.  You
will be prompted with something like:

        Buffer `*vc-diff*' undo info is 3001370 bytes long; discard it? (yes or 
no) 

This strikes me as an odd question, as I thought I had already
implicitly requested that the buffer be completely trashed by "C-x v =".
(But then, I never knew I could undo these . . . )

   The patch below is sufficient to get rid of undo in *vc-diff*, but is
very much suboptimal, since it happens after all the diffing is done.
Furthermore, it doesn't allow users to undo manual edits made
afterwards, e.g. splitting hunks, which is surely unacceptable.  I'd be
happy to do a better job, but I haven't had a chance to sign copyright
papers, and the result might not be considered "trivial" . . .

   But I expect this issue also affects other applications of diff-mode,
and therefore requires a wider policy decision in any case.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

------------------------------------------------------------------------
Index: lisp/vc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc.el,v
retrieving revision 1.418
diff -c -r1.418 vc.el
*** lisp/vc.el  13 Apr 2006 13:35:55 -0000      1.418
--- lisp/vc.el  1 Jun 2006 20:38:27 -0000
***************
*** 1789,1794 ****
--- 1789,1795 ----
      ;; buffer should affect the diff command.
      (vc-diff-internal file rev1 rev2))
    (set-buffer "*vc-diff*")
+   (buffer-disable-undo)
    (if (and (zerop (buffer-size))
           (not (get-buffer-process (current-buffer))))
        (progn


_______________________________________________
Emacs-devel mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]