Explain or document a "Panic button" if something breaks badly

Sometimes I break my Doom installation after fiddling with doom {compile,build,sync}. Ok, fine, it’s my fault.

But when this happen in a day in which I cannot afford Doom to break (because I have work to do), I don’t have time to parse inscrutable bytecode errors. I just need Doom to work again. Now.

Most of the issues related to cached bytecode seems to disappear when (surprise!) completely deleting any cache. I think doom clean gets close but I if I understand it only deletes the private config cache.

I’d love if there was a doom clean --all option which would run the equivalent of:

find $EMACSDIR/ -name '*.elc' -delete

At least that would expose more clearly if there’s an error in the user configuration, right?

Anything I am missing? Opinions?

Thanks

1 Like

So what’s now the suggested strategy to remove all package and personal config *.elc files? Maybe running find $EMACSDIR/.local/straight/build-xx.yy.zz/ -name '*.elc' -delete?

To answer this question from Github: you’re asking for a strategy for two separate things: removing package byte-code and removing personal config bytecode.

Package byte-code

;;; add to $DOOMDIR/packages.el
;; to disable for a single package:
(package! some-package :recipe (:build (:not compile)))

;; to disable for all packages:
(setq straight-disable-compile t)

Then run doom sync (and, of course, restart Emacs).

Personal config byte-code

The suggested strategy for this is to never byte-compile your config files at all. doom compile (and doom clean) were removed because they provided little-to-no benefit for the trouble it caused. It only really existed so power users to experiment with, at their own risk, but many users mistook it as a “free” performance boost (which it isn’t, except in very specific contexts), disregarding the repercussions.

Byte-compiling Doom’s source is not supported, and is more complicated than it sounds, but you can compile your private config with M-x byte-recompile-directory RET $DOOMDIR or emacs --batch -f batch-byte-recompile-directory $DOOMDIR to do it (along with your find command to undo it).


In any case, doom sync (or doom sync -b (which is the same as doom build and will replace it later) to rebuild all packages) is all you should need.

Hope that helps!

thanks for the feedback.

Since compiling bytecode cache was recently removed in commit refactor!(cli): remove compile and clean commands · doomemacs/doomemacs@63c470b · GitHub, I agree that this is not an issue anymore.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.