Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: list-packages [no match]

I'm new to Emacs. I'd like to install a package, but doing M-x package-install says there is no such command.

Trying to look which packages are installed with M-x list-packages does not work either. GNU Emacs manual does not say much about it (or I looked in a wrong place), and I can't quite come up with meaningful keywords for search due to my limited Emacs knowledge.

like image 426
Tim Avatar asked Dec 20 '13 21:12

Tim


1 Answers

Thanks phils and shyamupa for setting me on track. Indeed, I am using emacs 23 ("M-x version" to check).

I used instruction from here to install packaging system. I had to copy the following in scratch:

(let ((buffer (url-retrieve-synchronously
               "http://tromey.com/elpa/package-install.el")))
  (save-excursion
    (set-buffer buffer)
    (goto-char (point-min))
    (re-search-forward "^$" nil 'move)
    (eval-region (point) (point-max))
    (kill-buffer (current-buffer))))

and then M-x eval-buffer

Then, M-x package-list-packages works.

UPDATE:

It turns out I was looking for a package in MELPA, and the above procedure sets you up for ELPA only. The content of my .emacs file after installation was following:

(when
    (load
     (expand-file-name "~/.emacs.d/elpa/package.el"))
  (package-initialize))

To enable MELPA load I had to replace the contents of package.el with this and change .emacs as follows (inspired by this SO question):

(load (expand-file-name "~/.emacs.d/elpa/package.el"))
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)

This did the trick and I got a huge list of packages from MELPA. Hope this will save someone time in future.

like image 85
Tim Avatar answered Nov 18 '22 00:11

Tim