summaryrefslogtreecommitdiffstats
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
parentc10d653b43b37e4af98c0c12d4c2abbd85834315 (diff)
downloademacs-397bd61324798d04e7e8a7fecdfa9dbf885926bd.tar.gz
emacs-397bd61324798d04e7e8a7fecdfa9dbf885926bd.zip
Move load-path init to init.org
-rw-r--r--.emacs.d/init.el21
-rw-r--r--.emacs.d/init.org41
2 files changed, 41 insertions, 21 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 343869b..49f2250 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -771,16 +771,6 @@ If no direction is given, don't split."
(define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand))
-;;;;; Macro support
-
-(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)))))
-
;;;; Modes
;; Copied from electric.el, modified from `electric-indent-local-mode'.
@@ -918,17 +908,6 @@ from myaethon2.core.decorators import (
Location,
)")))))
-;;;; Load path
-
-(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")))
-
-(add-to-list 'load-path "/usr/lib/node_modules/tern/emacs/")
-
;;;; Unconditional settings
(setq gnus-init-file "~/.emacs.d/site-lisp/gnus-init")
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