Emacs: list-packages [no match] - emacs

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.

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.

Related

package-install can't find icicles

I'm trying to install icicles in Emacs because I've read it makes for a more clear emacs experience. The problem is, even though I'm loading the Melpa repositories, and Checked melpa for if the package was available (it was) If I try package-install on it, it returns [no match].
I've tried package-refresh-contents to na avail. Please help with this, I could do it manually, but AUGH!
Just for context, here's the contents on my .emacs:
;; packages
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("org" . "http://orgmode.org/elpa/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(add-to-list 'load-path "~/.emacs.d/elisp")
(defun require-package (package)
(setq-default highlight-tabs t)
"Install given PACKAGE."
(unless (package-installed-p package)
(unless (assoc package package-archive-contents)
(package-refresh-contents))
(package-install package)))
(package-initialize)
(load-theme 'zenburn t)
(require 'php-mode)
(eval-after-load 'php-mode
'(require 'php-ext))
(add-to-list 'auto-mode-alist '("\\.json$" . js-mode))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes (quote ("f5eb916f6bd4e743206913e6f28051249de8ccfd070eae47b5bde31ee813d55f" default))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;;
Thanks in advance, all help is very much appreciated
Icicles is no longer distributed on ELPA or MELPA:
NOTE:
Icicles, as well as my other libraries that are on EmacsWiki, used to be obtainable also from MELPA. You may still find some of them there, but they are likely not up-to-date.
As of 2017-10, MELPA has decided to no longer accept Lisp libraries from EmacsWiki. This includes my libraries, even though these libraries are read-only (administrator lock on the wiki pages). Too bad. This means that you must download Icicles and my other libraries only from Emacs Wiki. Sorry about that. I upload Icicles files only to the wiki.
https://www.emacswiki.org/emacs/Icicles_-_Libraries
Solved the problem by doing M-x eval-buffer on my .emacs.

How to connect Hyperspec documentation to Emacs SLIME on MS Windows

With this minimal init file:
(setq package-load-list '((slime t)))
(setq inferior-lisp-program "clisp")
(package-initialize)
(setq package-enable-at-startup nil)
(require 'slime)
(slime-setup)
(slime)
(find-file "~/t/del.lisp")
Everything seems to work, such as slime-eval-defun and slime-complete-symbol, except for looking up documentation. M-x slime-describe-symbol RET print RET results in this error:
CLHS-ROOT: variable *CLHS-ROOT-DEFAULT* has no value
What do I need to add in my init file to make it work?
I also tried downloading the hyperspec tar file and extracting it to a directory, and this code:
(setq package-load-list '((slime t)))
(setq inferior-lisp-program "clisp"
common-lisp-hyperspec-root "c:/run/HyperSpec/"
common-lisp-hyperspec-symbol-table "c:/run/HyperSpec/Data/Map_Sym.txt")
(package-initialize)
(setq package-enable-at-startup nil)
(require 'slime)
(slime-setup)
(slime)
(find-file "~/t/del.lisp")
That doesn't work either. I do not know if the bug is in that init file, or in the SLIME version I am using, because this is my first time with SLIME.
Versions:
MS Windows 7
Emacs version 24.3.1 (probably latest stable)
SLIME version 20130626.1151 (latest from MELPA) (One from Marmalade says it can't compile nil, I don't know what that means and so I am using one from MELPA instead)
GNU CLISP 2.49 (latest stable)
UPDATE
C-c C-d f RET print RET works fine. This is bound to slime-describe-function, which is undocumented, and not listed in SLIME menu. There is also slime-documentation-lookup which is bound to C-c C-d C-d which can open documentation for variables (not just functions) in a browser, and that works too. Looks like only `slime-describe-symbol doesn't work.
I haven't done it on Windows, but if I were you, I'd try to do this with Quicklisp: (ql:quickload "clhs") and follow the printed directions.
I'd also get SLIME from Quicklisp via (ql:quickload "quicklisp-slime-helper"), but if your slime works ok, no real need.
Assuming that SLIME is installed from an emacs package archive (preferably MELPA) (and that GNU CLISP is installed), here is combination of relevant portions from How to install Common Lisp and SLIME on MS Windows:
Assuming starting from scratch after commenting out any SLIME customization code you already have, start by putting the following code to your init file which should be evaluated after package-initialize:
(setq inferior-lisp-program "clisp")
(setq slime-auto-connect 'ask)
(defun my-slime-setup ()
(require 'slime)
(slime-setup))
(defvar my--slime-setup-done nil)
(defun my-slime-setup-once ()
(unless my--slime-setup-done
(my-slime-setup)
(setq my--slime-setup-done t)))
(defadvice lisp-mode (before my-slime-setup-once activate)
(my-slime-setup-once))
What that does is defining my-slime-setup and make sure the function runs just once if you are using SLIME that day. my-slime-setup is also a container to which you can add your own SLIME customization code.
Now to connect the downloaded documentation to SLIME, extract the downloaded archive and you will get a folder with name Hyperspec, and then you move that folder to the Emacs bin directory, or its parent directory, or its grandparent directory, Put the following code in Emacs init file.
(defun my-hyperspec-setup ()
(let ((dir (locate-dominating-file invocation-directory "HyperSpec/")))
(if dir
(progn
(setq common-lisp-hyperspec-root (expand-file-name "HyperSpec/" dir)))
(warn "No HyperSpec directory found"))))
and add my-hyperspec-setup to my-slime-setup like this:
(defun my-slime-setup ()
(my-hyperspec-setup)
(require 'slime)
(slime-setup))
and restart Emacs.
And now when you do M-x slime-describe-symbol RET print RET in a lisp buffer, it should show the description of PRINT in another buffer.
I should confess that I am sourcing from my own article and also answering my own question after about 8 months. The answer is tested with latest SLIME from MELPA and on a vanilla GNU Emacs.

Emacs ess auto-complete

I am a R user, I want to use R in emacs. But, I am in trouble with customizing ess in emacs. I have installed the auto-complete packages and the latest ess in my emacs. But when I run r in emacs, the auto-complete don't work well.
When I type app, I suppose to show like the image in (http://www.emacswiki.org/pics/static/ess-ac3) , but in my emacs neither of the auto-complete nor the yellow part shows.
My OS: ubuntu 12.04 amd64
my ~/.emacs file
;; Auto-complete
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/ac-dict")
(ac-config-default)
; ess-site
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess")
(require 'ess-site)
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil)
I recently started using ESS on Windows, and struggled with the same issue. I don't know all of the ins and outs but recent versions of ESS suggest using company-mode rather than auto-complete-mode. This minimal setup seems to have autocomplete working quite well for me on the following setup:
Windows 10 x64
R 3.4.3 x64
Emacs 25 x64 installed normally
MELPA repo enabled in init.el
package-install [RET] company
package-install [RET] ess
open a new R file in some directory
M-x company-mode to enable company-mode in the current buffer
`C-c C-z' to start an inferior R process
At this point, with the init.el file shown below, R completion is working, completing function calls, and package members. I think more configuration is needed to tailor it to your liking, but getting to this point took me long enough I consider it a success
init.el:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
)
(package-initialize)
;; emacs controlled settings
(custom-set-variables
'(package-selected-packages (quote (company ess)))
'(show-paren-mode t)
'(tool-bar-mode nil))
(custom-set-faces
'(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 113 :width normal)))))
(require 'company)
Auto-complete works for me with this setting
(setq ess-use-auto-complete t)
I got the same problem and the following code worked for me:
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize) ;load and activate packages, including auto-complete
(ac-config-default)
(setq ess-use-auto-complete 'script-only)
;;if not working, use the following instead of (setq ess-use-auto-complete 'script-only)
;;(global-auto-complete-mode t)

Setting up SLIME via macports

I followed the instructions as best I could for installing terminal SLIME on Mac OS X, but when I press M-x it does not prompt me.
I installed emacs and Lisp using the following two sudo commands:
sudo port install emacs +carbon
sudo port install sbcl slime
I got the following instructions:
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime")
(require 'slime-autoloads)
(setq slime-lisp-implementations
`((sbcl ("/opt/local/bin/sbcl"))
(abcl ("/opt/local/bin/abcl"))
(clisp ("/opt/local/bin/clisp"))))
(add-hook 'lisp-mode-hook
(lambda ()
(cond ((not (featurep 'slime))
(require 'slime)
(normal-mode)))))
(eval-after-load "slime"
'(slime-setup '(slime-fancy slime-banner)))
Populate the initialization list in SLIME-LISP-IMPLEMENTATIONS with
the correct paths to the Common Lisp exectuables you wish to use.
I'm not sure what that last bit means...
Anyways, I've never used Lisp or emacs before, most literal n00b directed instructions would be best. Just the bare minimum to write and execute common lisp with emacs.
Thanks!
Looks like you're on the right track already. Since you've only installed sbcl, and not the other lisps, just cut your initialization code down to this:
(add-to-list 'load-path "/opt/local/share/emacs/site-lisp/slime")
(require 'slime-autoloads)
(setq slime-lisp-implementations `((sbcl ("/opt/local/bin/sbcl")))
(add-hook 'lisp-mode-hook
(lambda () (cond ((not (featurep 'slime)) (require 'slime) (normal-mode)))))
(eval-after-load "slime" '(slime-setup '(slime-fancy slime-banner)))
After that, use M-x slime, and you should be good to go.

emacs setup for both clojure and common lisp with slime-fancy (slime-autodoc)

I set up emacs for both clojure and common lisp, but I want also (slime-setup '(slime-fancy)) for common lisp. If I add that line to init.el, clojure won't work: it gives me repl, but it hangs after I run any code.
My configuration
For clojure:
I set up clojure-mode, slime, slime-repl via ELPA
I run $ lein swank in project directory
Then M-x slime-connect to hack clojure
For common lisp I place this after ELPA code in init.el:
(add-to-list 'load-path "~/.elisp/slime")
(require 'slime)
(add-to-list 'slime-lisp-implementations '(sbcl ("/opt/local/bin/sbcl") :coding-system utf-8-unix))
;; (slime-setup '(slime-fancy))
So if I uncomment the last line, clojure will be broken. But slime-fancy a very important meta package for hacking common lisp.
Is there a way to set them both up to work without changing configuration and restarting when I need to switch languages?
Update
I found that slime-autodoc loaded with slime-fancy is the cause of hangs.
(slime-setup '(slime-fancy))
(setq slime-use-autodoc-mode nil)
This configuration lets run both common lisp and clojure SLIMEs. Even simultaneously. But without slime-autodoc.
I also found I'm using the CVS version of SLIME since I manually do (add-to-list 'load-path "~/.elisp/slime") after ELPA code. That does not solve the problem. Maybe there is a version from some magic date which works with clojure? Here a guy says CVS version works for him: http://www.youtube.com/watch?v=lf_xI3fZdIg&feature=player_detailpage#t=221s
Here is a solution. (using hooks)
That is ugly but quite convenient.
(add-hook 'slime-connected-hook
(lambda ()
(if (string= (slime-lisp-implementation-type) "Clojure")
(setq slime-use-autodoc-mode nil)
(setq slime-use-autodoc-mode t))
))
(add-hook 'slime-mode-hook
(lambda ()
(if (eq major-mode 'clojure-mode)
(slime-autodoc-mode 0)
(slime-autodoc-mode 1))))
Update
If the problem still exists on the slime-repl buffer, try the following code:
(add-hook 'slime-repl-mode-hook
(lambda ()
(if (string= (slime-lisp-implementation-type) "Clojure")
(progn (setq slime-use-autodoc-mode nil)
(slime-autodoc-mode 0))
(progn (setq slime-use-autodoc-mode t)
(slime-autodoc-mode 1)))))
I've been contemplating on the same problem recently. The issue is that the SLIME in ELPA is trimmed down and is next to useless for Common Lisp. One way you can circumvent the problem is to check out SLIME from CVS from the same date as the checkout was done for the ELPA package and add manually the missing stuff. Someone on #clojure told me he did that and the solution worked.
I personally find such a solution pretty ugly, but until someone manages to get the Clojure support into upstream SLIME there won't be a better one.
Alternatively you can add features to the slime-setup one by one and see what feature exactly is causing the problem with the Clojure evaluation - after all slime-fancy is simply a metafeature that just loads the most popular contrib features.
Btw you don't need the lines
(add-to-list 'load-path "~/.elisp/slime/contrib")
(setq slime-backend "~/.elisp/slime/swank-loader.lisp")
(require 'slime)
The contrib dir will be added automatically to the load path, the back-end is the default and if you're using 'slime-autoloads you should require slime before that, since this defeats the purpose of the autoload.
I use sbcl, clozure, and clojure: Getting Emacs, Slime, Common Lisp (SBCL, Clozure), and Clojure to Work Together