What byte compile setup can I use when writing my init files?

Have been doing M-x byte-compile-file directly. Would like to do a function that calls byte-compile-file on the current buffer.

1 Answer 1


For an initial compilation I would either M-x byte-compile-file M-n RET, or else use B in dired.1

For automatically maintaining the .elc file thereafter, I highly recommend using the auto-compile package:


1 More usually C-xC-jB -- refer to C-hig (dired-x)Optional Installation Dired Jump

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.