emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/undo.c [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/undo.c [lexbind]
Date: Tue, 06 Jul 2004 05:59:12 -0400

Index: emacs/src/undo.c
diff -c emacs/src/undo.c:1.55.2.2 emacs/src/undo.c:1.55.2.3
*** emacs/src/undo.c:1.55.2.2   Tue Oct 14 23:22:47 2003
--- emacs/src/undo.c    Tue Jul  6 09:31:32 2004
***************
*** 292,305 ****
  
  /* At garbage collection time, make an undo list shorter at the end,
     returning the truncated list.
!    MINSIZE and MAXSIZE are the limits on size allowed, as described below.
!    In practice, these are the values of undo-limit and
!    undo-strong-limit.  */
  
  Lisp_Object
! truncate_undo_list (list, minsize, maxsize)
       Lisp_Object list;
!      int minsize, maxsize;
  {
    Lisp_Object prev, next, last_boundary;
    int size_so_far = 0;
--- 292,306 ----
  
  /* At garbage collection time, make an undo list shorter at the end,
     returning the truncated list.
!    MINSIZE, MAXSIZE and LIMITSIZE are the limits on size allowed,
!    as described below.
!    In practice, these are the values of undo-limit,
!    undo-strong-limit, and undo-outer-limit.  */
  
  Lisp_Object
! truncate_undo_list (list, minsize, maxsize, limitsize)
       Lisp_Object list;
!      int minsize, maxsize, limitsize;
  {
    Lisp_Object prev, next, last_boundary;
    int size_so_far = 0;
***************
*** 308,314 ****
    next = list;
    last_boundary = Qnil;
  
!   /* Always preserve at least the most recent undo record.
       If the first element is an undo boundary, skip past it.
  
       Skip, skip, skip the undo, skip, skip, skip the undo,
--- 309,316 ----
    next = list;
    last_boundary = Qnil;
  
!   /* Always preserve at least the most recent undo record
!      unless it is really horribly big.
       If the first element is an undo boundary, skip past it.
  
       Skip, skip, skip the undo, skip, skip, skip the undo,
***************
*** 323,328 ****
--- 325,331 ----
        prev = next;
        next = XCDR (next);
      }
+ 
    while (CONSP (next) && ! NILP (XCAR (next)))
      {
        Lisp_Object elt;
***************
*** 338,350 ****
--- 341,360 ----
                            + SCHARS (XCAR (elt)));
        }
  
+       /* If we reach LIMITSIZE before the first boundary,
+        we're heading for memory full, so truncate the list to nothing.  */
+       if (size_so_far > limitsize)
+       return Qnil;
+ 
        /* Advance to next element.  */
        prev = next;
        next = XCDR (next);
      }
+ 
    if (CONSP (next))
      last_boundary = prev;
  
+   /* Keep more if it fits.  */
    while (CONSP (next))
      {
        Lisp_Object elt;




reply via email to

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