I recently decided to retrain myself as a terminal Emacs user (I'm nostalgic for the '80s and my old glorious green and black terminal :P).
Emacs package management has looked pretty awkward for a long time, but it's better now: Pallet and Cask are a pretty good way to manage your
.emacs package dependencies, if you pay some attention when setting them up.
But if you just install them without thinking about it, a mess may occur (happened to me ^^;).
So this is a guide to transition to Cask and pallet, while avoiding messing up your
I have tried this on OS X, but it will likely work on most UNIX versions.
The procedure is slightly different, depending on which of these two cases is yours:
- start from scratch with a clean emacs install
- commit the packages you already have installed with package.el
Start from scratch
You'll need to install Cask first, there are a few options:
- homebrew (Mac OS X)
- just curl it
- clone the repo
$ brew update
$ brew install cask
It will put cask.el somewhere, likely at
$ curl -fsSL https://raw.githubusercontent.com/cask/cask/master/go | python
Remember where it put your cask.
Clone the repo
git clone https://github.com/cask/cask.git
Remember where you put the cask dir on your filesystem.
cask to your
PATH. Homebrew will do that for you, you'll have to do it by hand if you installed in an arbitrary directory without homebrew.
Add this to
(require 'cask "<path to>/cask.el") (cask-initialize)
Now you need to install Pallet with Cask.
To do that:
$ emacs ~/.emacs.d/Cask
Running emacs will create a
~/.emacs.d/ directory, if it's not there already.
In the Cask file put:
(source melpa) (depends-on "pallet")
You can also put more sources in:
(source melpa-stable) (source gnu)
Now use the terminal at
$ cask install
This will bootstrap cask and pallet. It will create a
~/.emacs.d/.cask/ directory containing all the packages you will install.
Now you can add:
(require 'pallet) (pallet-mode t)
emacs, and from now on
pallet-mode will be active: any time you install a package with
M-x package-list-packages and similar,
pallet will write it down in your
Cask file and the files fill go under the
Save your packages to Cask
You have a working emacs configuration, and want to switch to Cask and pallet to maintain it.
Please follow all the steps, or it may end up borking your packages.
You need to install pallet first, through your package.el:
M-x package-install RET pallet RET
i over it, and then
This will create
~/.emacs.d/Cask which should contain a list of the packages you have already installed.
will copy your
elpa dir to your
Now you can get rid your
~/.emacs.d/elpa/ directory and any lines in your
init.el that setup sources for package.el or initialised it.
Add to your
.emacs or equivalent:
(require 'cask "<path-to-cask>/cask.el") (cask-initialize) (require 'pallet) (pallet-mode t)
you can also get rid of any package.el code in your
.emacs, Cask+pallet will handle that now.
Pallet-mode will save any packages you install to your cask file. If it's not enabled you'll lose those packages, they won't be included in any
M-x pallet-update or other pallet commands you'll do later.
Check if pallet-mode is active with
M-x pallet-mode. That will switch it on and off, so remember to turn it back on if you switched it off.
Hopefully this worked for you, and you can enjoy the convenience of
pallet, while avoiding having to reconstruct your dependency list.