emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/undo-fu-session 5cc4b4f33d 12/53: Fix for linearizing an e


From: ELPA Syncer
Subject: [nongnu] elpa/undo-fu-session 5cc4b4f33d 12/53: Fix for linearizing an empty undo-list disabling undo on reload
Date: Thu, 7 Jul 2022 12:05:16 -0400 (EDT)

branch: elpa/undo-fu-session
commit 5cc4b4f33d7213a555b429d33cd843f5ee9c4427
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Fix for linearizing an empty undo-list disabling undo on reload
---
 undo-fu-session.el | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/undo-fu-session.el b/undo-fu-session.el
index 6105c5c090..7ac0f256aa 100644
--- a/undo-fu-session.el
+++ b/undo-fu-session.el
@@ -111,11 +111,14 @@ Enforcing removes the oldest files."
           (setq undo-elt (pop undo-list))
           (push undo-elt linear-list))))
 
-    ;; Pass through 't', when there is no undo information.
-    ;; Also convert '(list nil)' to 't', since this is no undo info too.
+    ;; Pass through 'nil', when there is no undo information.
+    ;; Also convert '(list nil)' to 'nil', since this is no undo info too.
+    ;;
+    ;; Note that we use 'nil' as this is what `buffer-undo-list' is set
+    ;; to when there are no undo steps yet.
     (if (and linear-list (not (equal (list nil) linear-list)))
       (nreverse linear-list)
-      t)))
+      nil)))
 
 ;; ---------------------------------------------------------------------------
 ;; Undo Encode/Decode Functionality
@@ -492,6 +495,13 @@ Argument PENDING-LIST an `pending-undo-list'. compatible 
list."
               emacs-buffer-undo-list
               emacs-pending-undo-list)))
 
+        ;; It's possible the history was saved with undo disabled.
+        ;; In this case simply reset the values so loading history never 
disables undo.
+        (when (eq t emacs-buffer-undo-list)
+          (setq emacs-buffer-undo-list nil)
+          (setq emacs-pending-undo-list nil)
+          (setq emacs-undo-equiv-table '()))
+
         ;; Assign undo data to the current buffer.
         (setq buffer-undo-list emacs-buffer-undo-list)
         (setq pending-undo-list emacs-pending-undo-list)



reply via email to

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