emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change 7c24263: E


From: Phillip Lord
Subject: [Emacs-diffs] fix/no-undo-boundary-on-secondary-buffer-change 7c24263: Ensure we have two boundaries.
Date: Tue, 22 Sep 2015 20:46:24 +0000

branch: fix/no-undo-boundary-on-secondary-buffer-change
commit 7c24263b4e2be05cffd790ef8b664a534dfd0dd8
Author: Phillip Lord <address@hidden>
Commit: Phillip Lord <address@hidden>

    Ensure we have two boundaries.
    
    Also fix undo-size to initialize values which gives strange results 
otherwise.
---
 lisp/simple.el |   18 ++++++++++--------
 src/undo.c     |    2 +-
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index c04ff09..68299cb 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2766,9 +2766,11 @@ with < or <= based on USE-<."
 ;; removed from a buffer with any rapidity and no undo-boundary. In
 ;; this case, the `undo-outer-limit' machinary will operate; this is
 ;; considered to be exceptional the user is warned.
-(defun undo-has-boundary-p ()
+(defun undo-has-two-boundary-p ()
   "Returns t if `buffer-undo-list' contains a boundary."
-  (when (member nil buffer-undo-list)
+  (when
+      (member nil
+              (member nil buffer-undo-list))
     t))
 
 (defun undo-ensure-boundary ()
@@ -2791,11 +2793,11 @@ there is no other `undo-boundary', and 
`buffer-undo-list' is
 longer than `undo-limit'. It provides a useful default mechanism
 for adding an `undo-boundary' which retains data where possible,
 without signalling warnings to the user."
-  (unless (or
-           buffer-undo-list
-           (undo-has-boundary-p)
-           (< (undo-size)
-              undo-limit))
+  (when (and
+         buffer-undo-list
+         (not (undo-has-two-boundary-p))
+         (> (undo-size)
+            undo-limit))
     (undo-boundary)
     t))
 
@@ -2810,7 +2812,7 @@ See also `undo-ensure-boundary'."
          (message "undo-auto-boundary checking %s" b)
          (setq undo-buffer-undoably-changed nil)
          (when (undo-ensure-boundary)
-           (message "undo-auto-boundary added %s" b)))))
+           (message "undo-auto-boundary boundary added %s" b)))))
    undo-undoably-changed-buffers)
   (setq undo-undoably-changed-buffers nil))
 
diff --git a/src/undo.c b/src/undo.c
index 9bd5797..9f9dece 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -313,7 +313,7 @@ Otherwise, returns the size of `buffer-undo-list' in 
bytes.*/)
     return Qnil;
 
   Lisp_Object prev, next;
-  EMACS_INT size_so_far, boundary_so_far, num;
+  EMACS_INT size_so_far = 0, boundary_so_far = 0, num = 0;
   if( ! NILP( n ) )
     {
       CHECK_NUMBER(n);



reply via email to

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