title: What's the magic behind the ELPA?
body: <p>I use Aquamacs, and I use ELPA that installs files in ~/.emacs.d/elpa?</p>
  
  <p>What's the magic behind this ELPA? I mean, without ELPA, I should download and install the packages in a specific directory, and add those two lines in .emacs.</p>
  
  <blockquote>
    <p>(add-to-list 'load-path "PACKAGE_DIRECTORY")<br>
    (require 'PACKAGE)</p>
  </blockquote>
  
  <p>But, with ELPA, I don't see anything added to .emacs or  /Users/smcho/Library/Preferences/Aquamacs Emacs/{Preferences.el, customizations.el}. How is this possible? </p>
  
  <h2>Added</h2>
  
  <p>This is what I found with Aquamacs.</p>
  
  <ol>
  <li>Aquamacs reads ~/Preference/Aquamacs Emacs/Preference, and it has "(add-to-list 'load-path kitfiles-dir)(require 'init)", which reads start kit.</li>
  <li>The init.el of start kit has the "(require 'package)(package-initialize)"</li>
  <li>~/Library/Preferences/Aquamacs Emacs/aquamacs-emacs-starter-kit/vendor has the package.el </li>
  </ol>
  
  <p>I guess the initialization files are not changed, but the package manager reads the ~/.emacs.d/elpd/* to initialize automatically, as I see ***-autoloads.el in each of it.</p>
  
  <h2>Added2</h2>
  
  <p>With emacs 24, it seems that package is pre-built. I need only to have these lines in .emacs or .emacs.d/init.el to get ELPA working. Hints from <a href="http://www.kedrovsky.com/blog/clojure-emacs-nrepl-and-leiningen" rel="noreferrer">this site</a>.</p>
  
  <pre><code>(require 'package)
  (add-to-list 'package-archives
           '("marmalade" . "http://marmalade-repo.org/packages/"))
  (package-initialize)
  
  (when (not package-archive-contents)
    (package-refresh-contents))
  (defvar my-packages '(clojure-mode
                 nrepl))
  (dolist (p my-packages)
    (when (not (package-installed-p p))
      (package-install p)))
  </code></pre>