this post was submitted on 12 Oct 2023
1 points (100.0% liked)

Emacs

312 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hi all,

I recently did "something" in an emacs buffer and lost a bunch of text in different places, and I was unable to undo the deletions. I tried to use ediff (I guess I should have used ediff-backup?) to recover the lost text but not being competent I mixed up buffers "A" and "B" and ended up copying the deletions to the backup file and couldn't recover from there .... :-).

Now I am curious if there are recent 'best practices' to

  1. Avoid doing 'something' that causes text to disappear
  2. Have a more robust, for a beginner like me, set of autosave and associated settings.

I found/checked the following sources:

https://www.gnu.org/software/emacs/manual/html_mono/ediff.html#Major-Entry-Points

https://www.reddit.com/r/emacs/comments/5h7k1r/undo_lost_hours_of_work/

https://www.gnu.org/software/emacs/manual/html_node/elisp/Auto_002dSaving.html

https://www.reddit.com/r/emacs/comments/3sqtig/important_block_of_text_disappeared_from_my_notes/

https://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html

However, regarding the manuals, I think I could benefit from some guidance on how to set up the most robust system (I rather have a lot of littering but with a robust ability to recover files vs a no-littering approach). And regarding users that experienced the same issue, the posts and replies are several years old so maybe obsolete with current emacs version (and package ecosystem).

I am looking for some recommendation to either disabling certain key bindings (e.g., linked to commands that can select/delete a lot of text), or perhaps change certain default settings (e.g., like the one for org-mode that prevents deleting text in folded sections). Or anything that works for you :-).

If the answer is outside of emacs, ie use git with some auto-commit script running in the background, I'd be interested in recommendations as well. I use emacs on my personal MacBook Air and on my company Windows laptop. I don't need to share my files with anyone, I just want to be able to recover from stupid user errors on my side :-).

(I backup to external drives as well, but my scenario is more 'OMG I pressed some key chord when I was doing something else and thought another application was focused but it wasn't. Worst part is I typically don't notice immediately, but only after a while, I may have even been adding a lot of text before realizing I somehow lost a whole bunch of other text somewhere else in a file - I think I read about a setting that asked for confirmation before a large amount of text is killed, but I couldn't find it back. And I also make such mistaken on smaller pieces of text, like a TODO heading in org-mode.)

Thank you for help,

Paul

you are viewing a single comment's thread
view the rest of the comments
[–] troll-gpt@alien.top 1 points 1 year ago (1 children)

Git project, magit and magit-wip mode which creates intermediate commits automatically. In general file editing, emacs file backups are pretty good; learn to work with them.

[–] Wumpitz@alien.top 1 points 1 year ago

magit-wip saved me a couple of times. And I'm doing magit-snapshots each time when my project compiled successfully.