Is there any differences between the following two ways of invoking a function in the init file.

(add-hook `after-init-hook `turn-on-auto-fill)


  • 2
    It's enough to read what C-h v after-init-hook tells you: the functions on the hook are run after your init file is completely loaded. Your second sexp is evaluated immediately, as soon as it is read in your init file, i.e., before the rest of the file is read.
    – Drew
    Aug 2, 2016 at 16:46

1 Answer 1


The main difference is time of evaluation. The former is evaluated after all init files are run, whereas the latter is evaluated immediately.

The advantage of the former is, that you can initialize and require some nice or required stuff before running a command. The disadvantage is, that errors in your init scripts may lead to never firering the after-init-hook and thus never evaluating your command.

You may find more details in the GNU Emacs Lisp Reference for The Init File.

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.