emacs-devel
[Top][All Lists]
Advanced

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

Re: undo bug?


From: martin rudalics
Subject: Re: undo bug?
Date: Tue, 01 Apr 2008 22:53:27 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>>Couldn't we do away with undo-boundaries and always undo until the next
>>recorded position of `point'?
>
>
> In theory we could, but that may break various packages: of all the
> supported undo records, the "undo-boundary" is probably the only one
> that is used by external packages ;-(

What I had in mind was that `undo-boundary' would simply `record-point'
instead of inserting nil.

> Instead the current code tries to only insert a point-record when
> it's actually necessary.

Sometimes.  For example I use the patch below to handle the (pretty
annoying) problem that when I redo an earlier insertion `point' ends up
_before_ the inserted text (my `undo' binds `undo-is-redo' to `equiv'
when calling `undo-more').

*** undo.c.~1.83.~      Sun Jan 20 10:33:56 2008
--- undo.c      Fri Mar  7 19:38:40 2008
***************
*** 57,62 ****
--- 57,66 ----

  int undo_inhibit_record_point;

+ /* Nonzero means undo is redo.  */
+
+ int undo_is_redo;
+
  /* Record point as it was at beginning of this command (if necessary)
     and prepare the undo info for recording a change.
     PT is the position of point that will naturally occur as a result of the
***************
*** 637,643 ****
                         so that undoing the marker adjustments
                         put the markers back in the right place.  */
                      Finsert (1, &membuf);
!                     SET_PT (pos);
                    }
                }
              else if (MARKERP (car) && INTEGERP (cdr))
--- 641,648 ----
                         so that undoing the marker adjustments
                         put the markers back in the right place.  */
                      Finsert (1, &membuf);
!                     if (! undo_is_redo)
!                       SET_PT (pos);
                    }
                }
              else if (MARKERP (car) && INTEGERP (cdr))
***************
*** 735,740 ****
--- 740,749 ----
    DEFVAR_BOOL ("undo-inhibit-record-point", &undo_inhibit_record_point,
               doc: /* Non-nil means do not record `point' in 
`buffer-undo-list'.  */);
    undo_inhibit_record_point = 0;
+
+   DEFVAR_BOOL ("undo-is-redo", &undo_is_redo,
+              doc: /* Non-nil means undo is redo.  */);
+   undo_is_redo = 0;
  }

  /* arch-tag: d546ee01-4aed-4ffb-bb8b-eefaae50d38a





reply via email to

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