Load-path and load lisp file

after setting the path for lisp files in emacs in a .emacs file like

(add-to-list 'load-path "~ / elisp /")

logically, I should also use the load command for a specific file. I guess this team

I tried

(load-file-name "google-c-style") with the addition of .el, also for the file, which should be the right way to do this

However, there was no success.

+2
source share
3 answers

It is just (load) , not (load-file-name) .

+6
source

If .el has a string like (provide 'google-c-style) , then all you need in your .emacs is:

 (require 'google-c-style) 
+6
source

load-file-name is a variable that contains the full name of the file loaded by 'load'

use the name of the Chv boot file to read the documentation

Now, to load the file, use the "load" function - it looks for the source or binary files in the downloaded paths

For example: (download "google-c-style.el")

Note. There are other load-file'and 'load-library functions that work slightly differently. Read more about this here: http://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Libraries.html#Lisp-Libraries

In addition, as mentioned in one of the answers, you can also use the provide function - require. Read this post to learn more about the differences between these functions (load, load-file, require, autoload)

http://ergoemacs.org/emacs/elisp_library_system.html

+2
source

Source: https://habr.com/ru/post/1333715/


All Articles