I'm not familiar with elisp at present.

I put my local configuration into init-local.el and exclude it in .gitignore.

I use (require 'init-local nil t) in init.el file before, however I think (require 'init-local) could have the same effect when I review my init.el today.

So I have the question : What's the difference of (require 'init-local nil t) and (require 'init-local) ?

;;; update

Thanks @phils and @DoMiNeLa10, after your comment and answer, I understand that it must be (require 'init-local nil t) because the file init-local.el is optional, if I use (require 'init-local) and the file init-local.el is missing I will get the error:

File is missing: Cannot open load file, No such file or directory, init-local

  • 3
    C-h f require – phils Sep 4 '17 at 12:13
  • 2
    What @phils said - ask Emacs. Also: C-h i, choose Elisp, require takes you to the Elisp manual, node Named Features, which tells you everything about require. Also, C-h r load takes you to the Emacs manual, node Lisp Libraries, which covers loading Lisp libraries in general. – Drew Sep 4 '17 at 12:56

require takes following arguments:

(require FEATURE &optional FILENAME NOERROR)

The NOERROR argument causes the function to return nil when file with the feature isn't found. Without that argument set to t, you'd get an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.