-;;------------------------------------------------------------------------------
 ;; Find and load the correct package.el
-;;------------------------------------------------------------------------------
 
 ;; When switching between Emacs 23 and 24, we always use the bundled package.el in Emacs 24
-(let ((package-el-site-lisp-dir (expand-file-name "~/.emacs.d/site-lisp/package")))
+(let ((package-el-site-lisp-dir
+       (expand-file-name "site-lisp/package" user-emacs-directory)))
   (when (and (file-directory-p package-el-site-lisp-dir)
              (> emacs-major-version 23))
     (message "Removing local %s package.el from load-path to avoid shadowing bundled version" package-el-site-lisp-dir)

;; un-comment below code if you prefer use all the package on melpa (unstable) without limitation
;; (setq package-filter-function nil)

;;------------------------------------------------------------------------------
;; Fire up package.el and ensure the following packages are installed.
;;------------------------------------------------------------------------------

(package-initialize)

(require-package 'all)
(require-package 'cl-lib '(0 0 5) nil)

          archive))
    ad-do-it))


;;; On-demand installation of packages

(defun require-package (package &optional min-version no-refresh)
  "Ask elpa to install given PACKAGE, optionally requiring MIN-VERSION.
