load
load → is the general function for loading a file.
1 | (load FILE &optional NOERROR NOMESSAGE NOSUFFIX MUST-SUFFIX) |
举个例子,如果你的代码是 (load "x")
,emacs 将从 load-path 中尝试加载 x.elc、x.el、x 文件。
load-file
load-file → load one specific file. The file name argument should contain file name extension, such as .el .elc
(load-file file_name)
just calls (load (expand-file-name file_name) nil nil t)
Use load-file when you have a specific full path of a file in mind.
举个例子:
1 | load-file "~/.emacs.d/lisp/init-example.el" |
这是最为原始的方式,填写的路径必须是绝对路径,这个路径也不会加入到emacs中load-path里。它也不会优先寻找编译过.elc文件(显然编译过文件的会更快些)。这种方式已经被抛弃,仅作为历史提一下。