0

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.

enter image description here

However it does not work in Aquamacs (melpa is not added to the variable package-archives)

enter image description here

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.
1
  • 2
    Note that (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))
    – Malabarba
    Apr 6, 2015 at 23:29

1 Answer 1

3

I think I found out why.

The variable user-emacs-directory is set to "~/Library/Preferences/Aquamacs Emacs/Packages/" by default.

When I add this to ~/.emacs.d/init.el,

(setq user-emacs-directory "~/.emacs.d")

the problem is resolved.

2
  • At the bottom of the link to the following thread are a few variables that the user may customize after Aquamacs is built: stackoverflow.com/a/16444817/2112489 -- some, however, cannot be changed unless done prior to building it from source. The thread is about 2 year old and I haven't touched it since, but the variables that are modifiable probably haven't changed.
    – lawlist
    Apr 6, 2015 at 3:49
  • However there is a reason Aquamacs changed this - with that value some things break - see Aquamacs code line 197 > ;; Before Aquamcas 3.1, user-emacs-directory was not in "Packages" ;; It was moved to the new location in order to avoid having ;; emacs-user-directory as part of load-path, which caused (load "tramp") to ;; load the wrong file. GNU Emacs bug #18512
    – mmmmmm
    Apr 23, 2019 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.