I was using emacs (XEmacs actually) and using the scratch buffer to experiment with regular expressions for a regex-replace operation that was giving me trouble. That has nothing to do with the problem, just setting the context.

A power failure caused me to have to reboot my computer and restart emacs. Because scratch can't be saved without explicitly copying it to a file, it's gone.

Is there any way to recover the previous (before the power failure) contents of scratch and, if so, how do I do it?

I'm not looking for suggestions for how to prevent this from being a problem in the future---I've figured that out. I just want restore the scratch contents that I just lost, if possible.

1 Answer 1


Buffers that are not saved to a file are just kept in memory. The contents of memory are lost on a reboot¹, so these buffers are gone. If you had a core dump, or a copy of your memory (such as you might get if you suspended your computer to disk), then perhaps you could recover it. Otherwise, no.

¹ Technically memory can remain readable for a few minutes without power if you freeze the ram using propellant from a can of compressed air, liquid nitrogen, or some other means. But you’re probably not set up for that on short notice.

  • That's what I assumed but I thought there might be a chance. Thanks for your answer.
    – Byron Dom
    Oct 28, 2021 at 3:00
  • @ByronDom if this answers your question then don't forget to accept the answer
    – Tom
    Oct 28, 2021 at 7:32
  • Tom. How do I accept an answer? I don't see a way. Maybe I already did without realizing it (?).
    – Byron Dom
    Oct 28, 2021 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.