This is the script I used to initialise packages in emacs:
Inside ~/.emacs.d/init.d
(load (expand-file-name "package_init.el")
user-emacs-directory)
Inside ~/.emacs.d/package_init.el
(require 'package) ;; You might already have this line
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line
These two scripts work well in emacs 24.
However it does not work in Aquamacs (melpa
is not added to the variable package-archives
)
I have already verified that aquamacs reads init.el
when it starts. Here is the start up message in *message*
buffer
Loading prestart plugin files ...
... done.
Wrote /Users/antkong/Library/Preferences/Aquamacs Emacs/Packages/.nosearch
Shell: /bin/zsh
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Recent Files.el (source)...done
Cleaning up the recentf list...done (0 removed)
22 environment variables imported from login shell (/bin/zsh).
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el (source)...done
Loading plugins ...
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el (source)...done
... done.
Loading `custom-file' failed.
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Preferences.el (source)...done
Mark set
one-buffer-one-frame-mode disabled.
Mark set [26 times]
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/frame-positions.el (source)...done
file-error: (Opening directory no such file or directory /Users/antkong/Library/Logs/CrashReporter)
Mark set [5 times]
Aquamacs is based on GNU Emacs, a part of the GNU/Linux system. It is Free Software: you can improve and redistribute it under the GNU General Public License, version 3 or later. (C) 2014 Free Software Foundation, and D. Reitter. No Warranty.
(load (expand-file-name "package_init.el") user-emacs-directory)
is wrong. You probably meant(load (expand-file-name "package_init.el" user-emacs-directory))