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

  • Wood_Work16666B
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 年前

    Should I worry that the utf-8 file I start editing becomes a text-raw-unix file on save and git commit over tramp/scp as indicated by the initial character on the modeline changing from U to t?

    The messages buffer mentions tramp encoding/decoding using

    Saving file /scp:s:/ftp/pub/users/x/index.gmi… Tramp: Encoding local file ‘/tmp/tramp.x.gmi’ using ‘(lambda (beg end) (let ((coding-system-for-write 'binary) (coding-system-for-read 'binary)) (apply #'tramp-call-process-region '(tramp-file-name scp nil nil s nil /ftp/pub/users/x/index.gmi nil) beg end (car (split-string env GZIP= gzip)) t t nil (cdr (split-string env GZIP= gzip)))) (base64-encode-region (point-min) (point-max)))’…done Tramp: Decoding remote file ‘/scp:s:/ftp/pub/users/x/index.gmi’ using ‘(base64 -d -i | env GZIP= gzip -d >%s)’…done Wrote /scp:s:/ftp/pub/users/x/index.gmi