[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/undo-tree d5a6148 120/195: Don't try to auto-save undo
From: |
Stefan Monnier |
Subject: |
[elpa] externals/undo-tree d5a6148 120/195: Don't try to auto-save undo history if undo is disabled in buffer. |
Date: |
Sat, 28 Nov 2020 13:41:35 -0500 (EST) |
branch: externals/undo-tree
commit d5a6148ddaab4a7637182effff3dfc9692354e0a
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Don't try to auto-save undo history if undo is disabled in buffer.
Also check if undo is disabled in undo-tree-save-history, in case it's
called
interactively, and assert that buffer-undo-list is not t in
undo-list-transfer-to-tree to aid future debugging.
This fixes errors triggered by undo auto-saving when saving an undo-disabled
buffer, and when manually calling undo-tree-save-history in an undo-disabled
buffer.
---
undo-tree.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/undo-tree.el b/undo-tree.el
index a6bf191..9f296fe 100644
--- a/undo-tree.el
+++ b/undo-tree.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2009-2012 Free Software Foundation, Inc
;; Author: Toby Cubitt <toby-undo-tree@dr-qubit.org>
-;; Version: 0.5.4
+;; Version: 0.5.5
;; Keywords: convenience, files, undo, redo, history, tree
;; URL: http://www.dr-qubit.org/emacs.php
;; Repository: http://www.dr-qubit.org/git/undo-tree.git
@@ -1613,6 +1613,10 @@ Comparison is done with `eq'."
(defun undo-list-transfer-to-tree ()
;; Transfer entries accumulated in `buffer-undo-list' to `buffer-undo-tree'.
+ ;; `undo-list-transfer-to-tree' should never be called when undo is disabled
+ ;; (i.e. `buffer-undo-tree' is t)
+ (assert (not (eq buffer-undo-tree t)))
+
;; if `buffer-undo-tree' is empty, create initial undo-tree
(when (null buffer-undo-tree) (setq buffer-undo-tree (make-undo-tree)))
;; make sure there's a canary at end of `buffer-undo-list'
@@ -2903,6 +2907,7 @@ Otherwise, prompt for one.
If OVERWRITE is non-nil, any existing file will be overwritten
without asking for confirmation."
(interactive)
+ (when (eq buffer-undo-list t) (error "No undo information in this buffer"))
(undo-list-transfer-to-tree)
(when (and buffer-undo-tree (not (eq buffer-undo-tree t)))
(condition-case nil
@@ -3006,11 +3011,13 @@ signaling an error if file is not found."
;; Versions of save/load functions for use in hooks
(defun undo-tree-save-history-hook ()
- (when (and undo-tree-mode undo-tree-auto-save-history)
+ (when (and undo-tree-mode undo-tree-auto-save-history
+ (not (eq buffer-undo-list t)))
(undo-tree-save-history nil t) nil))
(defun undo-tree-load-history-hook ()
- (when (and undo-tree-mode undo-tree-auto-save-history)
+ (when (and undo-tree-mode undo-tree-auto-save-history
+ (not (eq buffer-undo-list t)))
(undo-tree-load-history nil t)))
- [elpa] externals/undo-tree 824b904 129/195: Preparatory changes for lazy tree drawing., (continued)
- [elpa] externals/undo-tree 824b904 129/195: Preparatory changes for lazy tree drawing., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 40c7065 108/195: Added undo-tree-visualizer-abort command, Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 107d4c8 102/195: Allow visualizer to display relative timestamps., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 1561d8f 099/195: Preserve timestamps when generating diff for visualizer diff view., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 08db836 123/195: Fix bug in undo-tree-visualizer-select-left/right., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 6e5cc0f 104/195: Generate history save filename using a function, to allow customization., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 17568c3 113/195: Allow undo history save directory to be customized., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 965650c 127/195: Highlight node in visualizer corresponding to unmodified buffer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree ca9ec7b 105/195: Clear visualizer data / kill visualizer before saving history., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 270bc25 110/195: Added `~' to end of default history save-file name., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree d5a6148 120/195: Don't try to auto-save undo history if undo is disabled in buffer.,
Stefan Monnier <=
- [elpa] externals/undo-tree cfc036a 133/195: Fix undo-tree-redo to avoid corrupting undo-tree state if redoing fails., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree bdfd73f 132/195: Ignore bogus buffer modification entries in undo changesets., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 6e0775d 139/195: Use define-derived-mode and define-minor-mode for undo-tree visualizer., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree d6fa2e7 152/195: Reinstate accidentally deleted file header., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 8afead1 162/195: Add Maintainer line to package headers., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree e9a9102 164/195: Throw error if interactive commands called outside undo-tree-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree ffd18cd 175/195: Refactor undo-list-transfer-to-tree again in attempt to mitigate GC races., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 941bfe5 190/195: Don't attempt to save undo history if history file is unwritable., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 5a1ba84 017/195: Added standard Elisp package headers, including an extensive Commentary., Stefan Monnier, 2020/11/28
- [elpa] externals/undo-tree 62e6097 044/195: Added undo-tree-save/restore-state-to/from-register commands and keybindings, Stefan Monnier, 2020/11/28