0

Once in a while, emacs freezes while there is unsaved progress on my buffers. When it freezes, it does not accept my C-s or save-buffer attempts. Hence I have to restart it. When I restart emacs, my edits always get lost.

Is there any functions like save-on-quit, where it will force-save right before emacs quits or freezes? or is there any alternative solution for this?

3
  • Too vague, IMO. To make it operational, try to specify a recipe to repro whatever behavior you have in mind: "crash" or "freeze" (neither of which is, I suppose, related to Emacs quitting - "before emacs quits"). Beyond that, I expect the only (partial) "solution" to be suggested is to periodically save state - whatever state you're concerned about (e.g. manual edits).
    – Drew
    Commented Dec 27, 2022 at 22:28
  • This was the use I was having for years, emacs just become unresponsive, does not accept any input, does not respond to C-g ... I wish I know the recipe but I was not able to find it out
    – alper
    Commented Dec 27, 2022 at 22:33
  • Without more info I think the question isn't useful - and likewise possible answers for it. But maybe someone will prove me wrong.
    – Drew
    Commented Dec 27, 2022 at 22:37

1 Answer 1

1

Emacs doesn’t know that it is about to freeze. Therefore you cannot program it to save before freezing. You should work on solving the problem rather than trying to work around it. Most people do not have Emacs freeze for any reason, so it may be something unusual about your computer or configuration that causes it.

Do you know how to use strace or gdb to debug software? That’s where I would start if this were happening to me. Another possibility would be to try to find a reliable way to reproduce the problem, then use M-x report-emacs-bug to send a bug report, making sure to include those steps to reproduce.

4
  • I am not used to use strace or gdb to debug software, but I will try to investigate. This occurs usually when I work on a 2000 lines of a latex file , using auctex mode I feel like related to memory issue
    – alper
    Commented Dec 28, 2022 at 20:12
  • 1
    @alper see my comments in this question for some suggestions on where to start with ps and strace. gdb is a much larger topic which this comment is too small to contain... :-)
    – NickD
    Commented Dec 29, 2022 at 15:12
  • @NickD Thanks as always. Just a minor note, I observe the freeze right after Applying style hooks...done message from latex-mode . But I have no idea which style is this. I will try to analyze this based on your comments.
    – alper
    Commented Dec 30, 2022 at 9:18
  • That will require some analysis from within emacs: maybe edebug can help. strace and ps can't see what Emacs is doing except at the system call level for strace or process state level for ps.
    – NickD
    Commented Dec 30, 2022 at 16:00

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.