New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove undo-tree dependency #1074

Open
mrbig033 opened this Issue Jul 21, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mrbig033

mrbig033 commented Jul 21, 2018

Issue

Undo tree is an undo package that cannot keep undos.

Environment

Emacs version: Emacs 26.1.50
Operating System: Manjaro (current)
Evil version: Evil version 1.2.13
Evil installation type: MELP
Graphical/Terminal: Graphical
Tested in a make emacs session (see CONTRIBUTING.md): Yes
Undo configurations:

(use-package undo-tree
  :ensure t
  :init
  (setq undo-limit 78643200)
  (setq undo-outer-limit 104857600)
  (setq undo-strong-limit 157286400)
  (setq undo-tree-mode-lighter " UN")
  (setq undo-tree-auto-save-history t)
  (setq undo-tree-enable-undo-in-region nil)
  (setq undo-tree-history-directory-alist '(("." . "~/emacs.d/undo")))
 (add-hook 'undo-tree-visualizer-mode-hook (lambda ()
                                              (undo-tree-visualizer-selection-mode)
                                              (setq display-line-numbers nil)))
  :config
  (global-undo-tree-mode 1))

Reproduction steps

  • Start Emacs
  • Make 30 changes on a files an save each step
  • Restart Emacs
  • Try undoing and redoing those changes

Expected behavior

You should be able to undo and/or redo every single change

Actual behavior

When it works, I'm able to undo 5 changes at the most. Half the time I can't undo anything at all. Sometimes I get the message unrecognized entry in undo list undo-tree-canary while I'm performing the undo.

Further notes

It is not just me:

https://old.reddit.com/r/emacs/comments/85t95p/undo_tree_unrecognized_entry_in_undo_list/
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16523
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16377
https://lists.ourproject.org/pipermail/implementations-list/2014-November/002091.html
syl20bnr/spacemacs#298
syl20bnr/spacemacs#9903

I also must add that I had this same problem before with entirely different configurations, other versions of Emacs and operating systems.

@npostavs

This comment has been minimized.

Show comment
Hide comment
@npostavs

npostavs Aug 17, 2018

Make 30 changes on a files an save each step

Is there some specific set of changes needed for this? I tried with the below and got no errors (this doesn't load evil, but as far as I understand the bug is not related to evil-mode).

~/src/emacs$ emacs -Q -l bug-1074evil-undo-tree/setup.el -f bug-1074-do-changes -f kill-emacs
~/src/emacs$ emacs -Q -l bug-1074evil-undo-tree/setup.el -f bug-1074-undo --eval '(sit-for 2)' -f bug-1074-redo

Where is bug-1074evil-undo-tree/setup.el is

(defconst bug-1074-dir
  (file-name-directory (or load-file-name buffer-file-name)))

(setq undo-limit 78643200)
(setq undo-outer-limit 104857600)
(setq undo-strong-limit 157286400)
(setq undo-tree-mode-lighter " UN")
(setq undo-tree-auto-save-history t)
(setq undo-tree-enable-undo-in-region nil)
(setq undo-tree-history-directory-alist `(("." . ,(expand-file-name "undo" bug-1074-dir))))
(add-hook 'undo-tree-visualizer-mode-hook
          (lambda ()
            (undo-tree-visualizer-selection-mode)
            (setq display-line-numbers nil)))

(add-to-list 'load-path (expand-file-name "../elpa/packages/undo-tree/" bug-1074-dir))

(require 'undo-tree)

(global-undo-tree-mode 1)

(defun bug-1074-do-changes ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (insert (format "%d\n" i))
        (save-buffer)))))

(defun bug-1074-undo ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (undo-tree-undo)))))

(defun bug-1074-redo ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (undo-tree-redo)))))

npostavs commented Aug 17, 2018

Make 30 changes on a files an save each step

Is there some specific set of changes needed for this? I tried with the below and got no errors (this doesn't load evil, but as far as I understand the bug is not related to evil-mode).

~/src/emacs$ emacs -Q -l bug-1074evil-undo-tree/setup.el -f bug-1074-do-changes -f kill-emacs
~/src/emacs$ emacs -Q -l bug-1074evil-undo-tree/setup.el -f bug-1074-undo --eval '(sit-for 2)' -f bug-1074-redo

Where is bug-1074evil-undo-tree/setup.el is

(defconst bug-1074-dir
  (file-name-directory (or load-file-name buffer-file-name)))

(setq undo-limit 78643200)
(setq undo-outer-limit 104857600)
(setq undo-strong-limit 157286400)
(setq undo-tree-mode-lighter " UN")
(setq undo-tree-auto-save-history t)
(setq undo-tree-enable-undo-in-region nil)
(setq undo-tree-history-directory-alist `(("." . ,(expand-file-name "undo" bug-1074-dir))))
(add-hook 'undo-tree-visualizer-mode-hook
          (lambda ()
            (undo-tree-visualizer-selection-mode)
            (setq display-line-numbers nil)))

(add-to-list 'load-path (expand-file-name "../elpa/packages/undo-tree/" bug-1074-dir))

(require 'undo-tree)

(global-undo-tree-mode 1)

(defun bug-1074-do-changes ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (insert (format "%d\n" i))
        (save-buffer)))))

(defun bug-1074-undo ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (undo-tree-undo)))))

(defun bug-1074-redo ()
  (interactive)
  (let ((file (expand-file-name "xx.txt" bug-1074-dir)))
    (with-current-buffer (find-file-noselect file)
      (pop-to-buffer-same-window (current-buffer))
      (dotimes (i 30)
        (undo-tree-redo)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment