summaryrefslogtreecommitdiffstats
path: root/.emacs.d/init.org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-04-20 12:55:28 +0200
committerGravatar Tom Willemse2014-04-20 12:55:28 +0200
commit397bd61324798d04e7e8a7fecdfa9dbf885926bd (patch)
tree0c538480504dda4309dc1751b88a7592f9d6ff4b /.emacs.d/init.org
parentc10d653b43b37e4af98c0c12d4c2abbd85834315 (diff)
downloademacs-397bd61324798d04e7e8a7fecdfa9dbf885926bd.tar.gz
emacs-397bd61324798d04e7e8a7fecdfa9dbf885926bd.zip
Move load-path init to init.org
Diffstat (limited to '.emacs.d/init.org')
-rw-r--r--.emacs.d/init.org41
1 files changed, 41 insertions, 0 deletions
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