Revert 8edba655
: disable undo persistence
It doesn't fix the undo corruption bug.
This commit is contained in:
parent
5ae8dd3159
commit
e906b20400
1 changed files with 2 additions and 25 deletions
|
@ -209,32 +209,9 @@ fundamental-mode) for performance sake."
|
|||
|
||||
;; persistent undo history is known to cause undo history corruption, which
|
||||
;; can be very destructive! So disable it!
|
||||
(setq undo-tree-auto-save-history t
|
||||
(setq undo-tree-auto-save-history nil
|
||||
undo-tree-history-directory-alist
|
||||
(list (cons "." (concat doom-cache-dir "undo-tree-hist/"))))
|
||||
|
||||
(defun doom|save-undo-history ()
|
||||
(when (and (bound-and-true-p undo-tree-mode)
|
||||
buffer-file-name
|
||||
(file-writable-p buffer-file-name)
|
||||
(not (eq buffer-undo-list t))
|
||||
(not revert-buffer-in-progress-p))
|
||||
(quiet!
|
||||
(undo-tree-save-history nil t))))
|
||||
|
||||
(defun doom|save-all-undo-history ()
|
||||
(dolist (buffer (buffer-list))
|
||||
(with-current-buffer buffer
|
||||
(doom|save-undo-history))))
|
||||
|
||||
(remove-hook 'write-file-functions #'undo-tree-save-history-hook)
|
||||
(add-hook 'kill-emacs-hook #'doom|save-all-undo-history)
|
||||
(add-hook 'kill-buffer-hook #'doom|save-undo-history)
|
||||
|
||||
(defun doom*silence-undo-tree-load (orig-fn &rest args)
|
||||
"Silence undo-tree load errors."
|
||||
(quiet! (apply orig-fn args)))
|
||||
(advice-add #'undo-tree-load-history-hook :around #'doom*silence-undo-tree-load))
|
||||
(list (cons "." (concat doom-cache-dir "undo-tree-hist/")))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue