syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.89k forks source link

Persistent undo #774

Closed bandali0 closed 2 months ago

bandali0 commented 9 years ago

In vim, I can use something like this

set directory=~/.vim/swaps
if exists("&undodir")
    set undodir=~/.vim/undo
endif
set undofile

in my vimrc and have my undo history preserved. So, for instance if I make some changes and save and close vim. If later on I change my mind, I can open vim again, open the file and just undo (u) whatever I had done.

Using spacemacs, if I exit emacs, my undo history will be gone; meaning the next time I open emacs and open the file, pressing u does nothing.

Is there a way to have the undo history preserved, across launches?

aaronjensen commented 7 years ago

Lawlist has been working on an undo-tree fork.

Have you or anyone else successfully integrated this w/ spacemacs? I still don't actually know the proper way to replace a package with a fork.

braham-snyder commented 7 years ago

I still don't actually know the proper way to replace a package with a fork.

I suspect it is or will be https://github.com/emacscollective/borg, but I have yet to try it (I know very little about git submodules)

edit: and/or possibly https://github.com/raxod502/straight.el (like borg, also fairly inchoate)? huge README, but perhaps this section is also relevant: https://github.com/raxod502/straight.el#comparison-to-borg

sooheon commented 7 years ago

I tried Borg for a while, but updating across the board was not possible afaict.

raxod502 commented 7 years ago

@sooheon Try straight.el, which is like Borg except that it is a full-featured package manager rather than just a submodule power tool (not saying there is anything wrong with the latter, of course). In particular, M-x straight-pull-all updates all packages.

NB to @braham-snyder: indeed, straight.el is still pre-1.0, but it is likely stable enough to use (as in, it probably doesn't require regular debugging anymore—but feel free to open an issue if you find it does 😜).

@aaronjensen I would assume the correct way to integrate this into Spacemacs is to use Quelpa as that's what Spacemacs uses for its package management. But you could also try straight.el if you want to be adventurous… see https://github.com/raxod502/straight.el/issues/128.

sooheon commented 7 years ago

@raxod502 Haven't given straight.el a run yet, but I admire your code documenting philosophy ;)

diego898 commented 6 years ago

just want to see if there is any update on this? persistent undo is a huge issue for me! thanks!

ReneFroger commented 6 years ago

Which version are you running, @diego898 ?

diego898 commented 6 years ago

Im running:

and I have the following in my ~/.spacemacs:

; Persistent UNDO Tree
;;(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
(setq undo-tree-auto-save-history t
undo-tree-history-directory-alist
`(("." . ,(concat spacemacs-cache-directory "undo"))))
(unless (file-exists-p (concat spacemacs-cache-directory "undo"))
  (make-directory (concat spacemacs-cache-directory "undo")))
dbrw commented 6 years ago

Same here, would love to see any update.

Compro-Prasad commented 5 years ago

A new package https://github.com/jackkamm/undo-propose-el has been released and claims to be safer to use than undo-tree.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

Compro-Prasad commented 4 years ago

See http://www.dr-qubit.org/Lost_undo-tree_history.html for further details.

eugercek commented 4 years ago

@notbandali Thank you so much. Solved my problem. @braham-snyder +1 I thought it was because I'm using chemacs and files could collapse. For example when you do SPC q R spacemacs/restart-emacs it opens default one in chemacs. Probably simple 'emacs' call but I don't have any idea on elisp. Will learn e(lisp) immediately for tinkering around.

real-or-random commented 2 years ago

There's a PR to evil that (hopefully) fixes the issue but it's stalled unfortunately: https://github.com/emacs-evil/evil/pull/1430

fleimgruber commented 1 year ago

https://github.com/emacs-evil/evil/pull/1430 got merged in the meantime, so this could be tested again.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!