0

As most emacs user, I change my init.el fairly often. Sometimes a bug is introduced and the next time I start emacs I get an error message and a very ugly emacs without any of my keybindings. Then, I have to use this very basic emacs or (god forbid) another editor to correct the bug in init.el.

My question is: can I change it so that even if there is an error on one of the lines in init.el the rest of the script still is evaluated, and I just get an error message saying that some part failed?

shynur
  • 4,065
  • 1
  • 3
  • 23
TMat
  • 95
  • 9
  • found a similar Q&A [How to gracefully handle errors in init file](https://emacs.stackexchange.com/questions/669/how-to-gracefully-handle-errors-in-init-file) but I haven't tried whether it works in the current version. – roomworoof Mar 11 '23 at 14:13
  • 1
    Thanks for the link. I saw this kind of error-handling already but I wanted something that works with the whole script and not just some small part because I don't know which part of the init script will spawn a bug. Essentially I was searching for something close to bash default behavior: even when there are lines that cause error, the other lines are still evaluated and you don't need to wrap this in error-catching delimitors. – TMat Mar 11 '23 at 14:19
  • Split a long piece of code into several short pieces, and use `ignore-errors` forms to wrap them. – shynur Mar 11 '23 at 19:21

0 Answers0