I often run into a problem when I install packages with Emacs: what can I do if one of the packages is broken in melpa and the other is broken in melpa-stable? For example if I use melpa-stable elscreen fails on startup:
run-hooks: Symbol's function definition is void: elscreen-start
but if I run on melpa elscreen works but cider-nrepl fails to start up. I checked their github profile and their build is currently failing. Is there a way to work around this?
You can use both melpa and melpa-stable, and pin certain packages to certain repositories by customizing package-pin-packages:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(setq package-pinned-packages
'((imenu-anywhere . "melpa-stable")
(spaceline . "melpa-stable")
(clj-refactor . "melpa-stable")
(cider . "melpa-stable")
(clojure-mode . "melpa-stable")
(linum-relative . "melpa-stable")
(aggressive-indent . "melpa-stable")
(evil-leader . "melpa-stable")
(evil-visualstart . "melpa-stable")
(evil-jumper . "melpa-stable")
(evil-snipe . "melpa-stable")
(evil . "melpa-stable")
(evil-commentary . "melpa-stable")))
Related
I have a problem. If I copy any official code to enable package such elpy into my configuration I get:
Symbol's function definition is void: use-package
(use-package elpy
:ensure t
:init
(elpy-enable))
Please put this before using use-package:
(require 'package) ; Bring in to the environment all package management functions
;; A list of package repositories
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")
("elpa" . "https://elpa.gnu.org/packages/")))
(package-initialize) ; Initializes the package system and prepares it to be used
(unless package-archive-contents ; Unless a package archive already exists,
(package-refresh-contents)) ; Refresh package contents so that Emacs knows which packages to load
;; Initialize use-package on non-linux platforms
(unless (package-installed-p 'use-package) ; Unless "use-package" is installed, install "use-package"
(package-install 'use-package))
(require 'use-package) ; Once it's installed, we load it using require
;; Make sure packages are downloaded and installed before they are run
;; also frees you from having to put :ensure t after installing EVERY PACKAGE.
(setq use-package-always-ensure t)
I've got this in my init.el:
(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)
(setq package-archives '(("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "https://orgmode.org/elpa/")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Bootstrapping use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile (require 'use-package))
(use-package use-package
:config
(setq use-package-always-ensure t))
As far as I understand, this should be good to install all the packaged listed in
'(package-selected-packages
(quote
(org org-plus-contrib org-ref techela tuareg haskell-mode gnuplot gnuplot-mode helm-ispell ac-ispell paredit ox-tufte auctex json org-grep iedit wgrep helm geiser slime-company company-jedi zzz-to-char rainbow-delimiters avy ivy projectile twittering-mode zerodark-theme pretty-mode flycheck-clang-analyzer flycheck-irony flycheck yasnippet company-c-headers company-shell company-irony irony irony-mode company-lua mark-multiple expand-region popup-kill-ring dmenu ido-vertical-mode ido-vertical ox-html5slide centered-window-mode htmlize ox-twbs diminish erc-hl-nicks symon rainbow-mode switch-window dashboard smex company sudo-edit emms magit org-bullets hungry-delete beacon linum-relative spaceline fancy-battery exwm use-package)))
which is inside my custom-set-variables. However, when I do a first-time, clean (no existing elpa/ directory) startup of Emacs reading this init.el, not all of the packages are gotten and installed. But then I can do a package-install-selected-packages and, Emacs reports that it doesn't have anything in package-selected-packages. Looking at the variable confirms this. What could be going wrong? An older "working" version of this (with existing elpa/ directory) responds oddly to package-install-selected-packages, wanting to install e.g., auctex and some nine other packages that the package code above apparently isn't seeing or dealing with. I'm baffled as to why package-selected-packages seems to be so flaky for me. I'm assuming my older .emacs.d with the existing elpa/ has install info that is "working around" this failing package-selected-packages situation.
I am new to Emacs and perhaps that is the problem but I was following the instructions here:
https://github.com/ProofGeneral/PG
in particular after I added the given lines to my .emacs file, I did (M is the alt/option key):
M-x package-refresh-contents RET
but I got the error message:
[no match]
what is going wrong?
maybe this what I am doing wrong, what does:
M-x package-refresh-contents RET followed by M-x package-install RET proof-general RET
mean?
This is what works for me (TM):
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; Bootstrap use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(use-package proof-general
:no-require t
:ensure t)
The line will work if you have melpa as your package source. See the answer of ejgallego:
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
If you add these lines to your .emacs - file and then
M-x package-refresh-contents (followed by return)
M-x package-install (followed by return and then `proof-general`)
then it will work without explicitly adding the package in your .emacs-file.
I recently upgraded from the ada-mode built-in to Emacs for the updated elpa version (5.1.9) due to issues with compiling from within ada-mode with the earlier version (4.0.0).
In the updated package it is impossible to indent, with TAB performing no operation at all except to move all text on all lines to the leftmost column, regardless of whether it should be indented or not. No other type of indenting (ada-indent-current, ada-indent-region, or ada-indent-newline-indent) work either and neither does automatic indentation via RET.
There is no mention in *Messages* that there is any problem, and the built-in version has no trouble with the indentation.
I'm quite new to Emacs, but I've been trying to solve this problem for a while now with no solution in sight.
My init.el is below in case I've simply done something strange in my noviceness:
(package-initialize)
;; (setq package-enable-at-startup nil)
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("marmalade" . "https://marmalade-repo.org/packages/")
("melpa" . "https://melpa.org/packages/")))
(add-to-list 'load-path "~/.emacs.d/lisp")
(global-linum-mode t) ;; Show line numbers
(autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(when (eq system-type 'darwin) ;; mac specific settings
(setq mac-option-modifier 'meta))
(setq exec-path-from-shell-check-startup nil)
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
(ac-config-default)
Following the instructions here, I have not had any success. I put package.el inside my ~/.emacs.d/ folder.
Inside .emacs I put:
(add-hook 'after-init-hook (lambda ()
(load "~/.emacs.d/my-init.el")))
And myinit.el:
(when
(load
(expand-file-name "~/.emacs.d/package.el")))
(require 'package)
;; Any add to list for package-archives (to add marmalade or melpa) goes here, e.g.:
(add-to-list 'package-archives
'("marmalade" .
"https://marmalade-repo.org/packages/"))
(add-to-list 'package-archives
'("MELPA" .
"http://melpa.milkbox.net/packages/"))
(package-initialize)
I'm not getting any errors when I start emacs. But when I do M-x package-install [RET] afternoon-theme, for example, I get a message saying no packages found.