From 397bd61324798d04e7e8a7fecdfa9dbf885926bd Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 20 Apr 2014 12:55:28 +0200 Subject: Move load-path init to init.org --- .emacs.d/init.org | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to '.emacs.d/init.org') diff --git a/.emacs.d/init.org b/.emacs.d/init.org index c980f38..8460d7a 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -381,6 +381,47 @@ (defalias 'dabbrev-expand 'hippie-expand) #+END_SRC +* Setting up =load-path= + + First, to help, I create a function that takes a path, adds it to + =load-path= and then checks to see if there is a file named + ~loaddefs.el~ in the given path. If there is, it loads it. This + ~loaddefs.el~ file is something that is created from autoload cookies + in the files in some of these paths. + + Since the =load-path= is also important during byte-compilation, this + function should be defined both at run-time and compile-time. + + #+BEGIN_SRC emacs-lisp + (eval-and-compile + (defun oni:loadpath-add-and-autoload (path) + "Add PATH to `load-path' and load a `loaddefs.el' if it exists." + (add-to-list 'load-path path) + (let ((loaddefs (concat path "/loaddefs.el"))) + (when (file-exists-p loaddefs) + (load loaddefs))))) + #+END_SRC + + After that I add some directories to my =load-path= so I can use these + libraries when wanted. One of these is the ~site-lisp~ directory in my + ~.emacs.d~ directory, which is where I keep most of my personal + non-ELPA modules (like module-specific initialization files). There + are also some directories I include in ~vendor-lisp~, which is where I + keep modules that I didn't write myself and, for some reason, can't + or don't want to use ELPA for. Again it is important to realize that + this information is relevant both at run-time and compile-time, so + we wrap it with an =eval-and-compile=. + + #+BEGIN_SRC emacs-lisp + (eval-and-compile + (mapc #'oni:loadpath-add-and-autoload + '("~/.emacs.d/site-lisp" "~/.emacs.d/vendor-lisp/org/lisp" + "~/.emacs.d/vendor-lisp/org/contrib/lisp" + "~/.emacs.d/vendor-lisp/mozrepl" + "~/.emacs.d/vendor-lisp/eap" "/usr/share/emacs/site-lisp" + "/usr/lib/node_modules/tern/emacs/"))) + #+END_SRC + * Notes Here are some random or somewhat general notes about things you may -- cgit v1.2.3-54-g00ecf