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

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

[elpa] externals/undo-tree 18754c1 114/195: Use with-temp-buffer instead


From: Stefan Monnier
Subject: [elpa] externals/undo-tree 18754c1 114/195: Use with-temp-buffer instead of with-temp-file when saving undo history.
Date: Sat, 28 Nov 2020 13:41:33 -0500 (EST)

branch: externals/undo-tree
commit 18754c1d1198eed870fb3820e8848925f7fa6d23
Author: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>
Commit: Toby S. Cubitt <toby-undo-tree@dr-qubit.org>

    Use with-temp-buffer instead of with-temp-file when saving undo history.
    
    This allows auto-compression-mode to take effect if
    undo-tree-make-history-save-file-name has been advised in the user's .emacs 
to
    return a compressed filename extension.
---
 undo-tree.el | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/undo-tree.el b/undo-tree.el
index 83c1537..411e554 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.3
+;; Version: 0.5.4
 ;; 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
@@ -690,6 +690,12 @@
 
 ;;; Change Log:
 ;;
+;; Version 0.5.4
+;; * use `with-temp-buffer' instead of `with-temp-file' when saving undo
+;;   history, so that `auto-compression-mode' can take effect if
+;;   `undo-tree-make-history-save-file-name' has been advised in the user's
+;;   .emacs to return a compressed filename extension
+;;
 ;; Version 0.5.3
 ;; * modified `undo-list-transfer-to-tree' and `undo-list-pop-changeset' to
 ;;   cope better if undo boundary before undo-tree-canary is missing
@@ -3053,10 +3059,13 @@ without asking for confirmation."
        ;; discard undo-tree object pool before saving
        (setf (undo-tree-object-pool tree) nil)
        ;; print undo-tree to file
-       (with-temp-file filename
+       ;; NOTE: we use `with-temp-buffer' instead of `with-temp-file' to
+       ;;       allow `auto-compression-mode' to take effect
+       (with-temp-buffer
          (prin1 (sha1 buff) (current-buffer))
          (terpri (current-buffer))
-         (let ((print-circle t)) (prin1 tree (current-buffer))))))))
+         (let ((print-circle t)) (prin1 tree (current-buffer)))
+         (write-region nil nil filename))))))
 
 
 



reply via email to

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