Emacs Melpa: Package not found - emacs

I run the following command (M-x):
Install package: haskell-mode
Then I get the error:
[No match]
My .emacs is:
(require 'package)
(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.
'(package-archives
(quote
(("gnu" . "http://elpa.gnu.org/packages/")
("melpa-stable" . "http://stable.melpa.org/packages/")))))
(package-initialize)
And I ran also M-x package-refresh-contents.
How can I debug this error?

I removed "rm -rf" the dir "~/.emacs.d/" then it worked.

Related

Calling (require ...) on a MELPA installed package gives FlyCheck error "Cannot open load file"

I want to require some packages installed through MELPA so that i can access their variables and functions without getting "free variable" or "undefined function" warnings.
However, when I try to load a package it isn't found by Flycheck and i get a "Cannot open load file" error. It seems that the bytecode compiler doesn't read into the directory with the files installed by MELPA, but I don't know how to solve this.
I'm using Emacs 26.3 with Purcell's config that includes Flymake-Flycheck. This snippet covers the relevant parts of the init-elpa.el custom files where you can see the at the end that even if I install and then (require ...) a package it still is marked with an error by Flycheck.
;;; init-elpa.el --- Settings and helpers for package.el -*- lexical-binding: t -*-
(require 'package)
(require 'cl-lib)
;;; Install into separate package dirs for each Emacs version, to prevent bytecode incompatibility
(setq package-user-dir
(expand-file-name (format "elpa-%s.%s" emacs-major-version emacs-minor-version)
user-emacs-directory))
;;; Standard package repositories
(add-to-list 'package-archives '( "melpa" . "https://melpa.org/packages/") t)
(defun require-package (package &optional min-version no-refresh)
"Install given PACKAGE, optionally requiring MIN-VERSION.
If NO-REFRESH is non-nil, the available package lists will not be
re-downloaded in order to locate PACKAGE."
...)
(defun maybe-require-package (package &optional min-version no-refresh)
"Try to install PACKAGE, and return non-nil if successful.
In the event of failure, return nil and print a warning message.
Optionally require MIN-VERSION. If NO-REFRESH is non-nil, the
available package lists will not be re-downloaded in order to
locate PACKAGE."
...)
;;; Fire up package.el
(setq package-enable-at-startup nil)
(package-initialize)
(defvar sanityinc/required-packages nil)
(defun sanityinc/note-selected-package (oldfun package &rest args)
"If OLDFUN reports PACKAGE was successfully installed, note that fact.
The package name is noted by adding it to
`sanityinc/required-packages'. This function is used as an
advice for `require-package', to which ARGS are passed."
...)
(advice-add 'require-package :around 'sanityinc/note-selected-package)
(when (fboundp 'package--save-selected-packages)
(require-package 'seq)
(add-hook 'after-init-hook
(lambda ()
(package--save-selected-packages
(seq-uniq (append sanityinc/required-packages package-selected-packages))))))
;; READ HERE: now i try to install and require some packages.
(require-package 'fullframe)
(require-package 'evil)
(require 'fullframe) ;; Flycheck gives an ERROR: cannot open load file, files or directory does not exist
(require 'evil) ;; same as above
(require 'python) ;;this gives no error, since it's built-in i guess.
(provide 'init-elpa)
;;; init-elpa.el ends here
You can see that (package-initialize) is called so the load-path should be set. Also, I have flycheck-emacs-lisp-load-path set to 'inherit, which should mean that the bytecode compiler reads the same dirs as a normal emacs instance.
What should I do in order to make the bytecode compiler recognize my ELPA directory?
Check out flycheck-emacs-lisp-load-path variable
flycheck-emacs-lisp-load-path is a variable defined in ‘flycheck.el’.
... When set to ‘inherit’, use the ‘load-path’ of the current Emacs
session during syntax checking.
E.g you could do:
(use-package flycheck
:diminish ""
:custom
(flycheck-emacs-lisp-load-path 'inherit)
...

Emacs first boot won't install all packages from package-selected-packages

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.

Emacs24 auto-complete mode does not work

I have Emacs24, i want to use some modes like auto-complete.
Here is the thing, I installed 'linum' before and it's just working very well but others not working.
My .emacs file
(add-to-list 'load-path "/root/.scripts")
(require 'linum)
(global-linum-mode 1)
(require 'package)
(add-to-list 'package-archives '("melppa" . "http://melpa.milkbox.net/packages/"))
(package-initalize)
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(require 'yasnippet)
auto-complete and yasnippet just doesn't working , i tried command 'auto-complete-mode' but its still same.
Any ideas ?
EDIT : I installed it from source not from ELPA and it worked.
I had a similar issue when I upgraded to Emacs 24. Have you tried running M-x auto-complete? When I did, I got an error message like the following:
gv-get: (popup-cursor ac-menu) is not a valid place expression
It turned out this was an already reported bug that can be fixed by recompiling your byte-code:
https://github.com/auto-complete/auto-complete/issues/222
https://github.com/auto-complete/auto-complete/issues/118
This solution worked for me:
$ find ~/.emacs.d/elpa -name '*.elc' | xargs rm
(to remove all compiled elisp in your elpa subdirectories)
... then, in an elisp interaction buffer, like scratch eval:
(byte-recompile-directory (expand-file-name "~/.emacs.d/elpa") 0)
... then re-start emacs.

compile package is not loaded in chez scheme

I have installed petite chez scheme and used a .el config file as follows- my .emacs file:
(add-to-list 'load-path "/home/lambda/slime-2013-04-05") ; your SLIME directory
(setq inferior-lisp-program "/usr/bin/clisp") ; your Lisp system
(require 'slime)
(slime-setup)
(setq slime-protocol-version 'ignore)
;;petite scheme setup
(setq scheme-program-name "/home/lambda/csv8.4/custom/petite")
(load-file "/home/lambda/.emacs.d/scheme-setup.el")
(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-enabled-themes (quote (tango-dark))))
(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.
;; If there is more than one, they won't work right.
)
(add-hook 'lisp-mode-hook '(lambda ()
(local-set-key (kbd "RET") 'newline-and-indent)))
(if (fboundp 'global-font-lock-mode)
(global-font-lock-mode 1) ; GNU Emacs
(setq font-lock-auto-fontify t)) ; XEmacs
and the scheme-setup.el file I'm using is here:
https://github.com/tiljeset/emacs/blob/master/scheme-setup.el
Now, when I do
$ emacs -nw -f run-scheme
and compile with C-c C-k, I get the error:
Exception in compile-file: compile package is not loaded
Type (debug) to enter the debugger.
in the REPL. May I ask what is causing this problem?
(compile-file filename.ss)
gives the same error.
You have to buy the compile package. Instructions at www.scheme.com.

emacsclient not evaluating color-theme?

When I boot I launch emacs --daemon
and it evaluates my .emacs with one exception:
(add-to-list 'load-path "~/.elisp/zenburn-emacs") ;fix loading issue
(require 'zenburn)
;;; color theme - zenburn?
(add-to-list 'load-path "~/.elisp/color-theme")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)))
I know that the load-path stuff works because M-x zenburn loads the color scheme just fine once I launch emacsclient with emacsclient -nw.
Does anybody know what is up with (eval-after-load [snip - see above])?
Is this a bug?
System Info:
GNU Emacs 23.2.1
Installed in debian sid on2.6.32-5-amd64 Version: 23.2+1-7
Filename: pool/main/e/emacs23/emacs23_23.2+1-7_amd64.deb
And a tip from the current maintainer of Zenburn for Emacs(yours truly):
(add-to-list 'load-path "~/.elisp/color-theme")
(add-to-list 'load-path "~/.elisp/zenburn-emacs")
(require 'zenburn)
(zenburn)
You don't need to require color-theme since zenburn requires it internally. You do need, however, to call the zenburn function after you've required zenburn.
You're actually invoking the (zenburn) function when you type M-x zenburn and this is why the theme is getting applied just then instead of on startup.
You don't really say what isn't working?
(require 'zenburn) isn't enough to start the theme.
You need to call (color-theme-zenburn) as well (or its alias (zenburn), as you are doing interactively).
FWIW, here's how I load zenburn in my .emacs:
(require 'zenburn)
(zenburn)
Loads fine via emacsclient.
This is too long for a comment:
I have in my .emacs file the following line:
(setq default-frame-alist '((font . "Inconsolata-20") (tool-bar-lines . 0) (menu-bar-lines . 0)))
If I put for example
(color-theme-taylor)
after this line it works, if I put it before this line, it doesn't.
I.e.
(require 'color-theme)
(color-theme-initialize)
(setq default-frame-alist '((font . "Inconsolata-20") (tool-bar-lines . 0) (menu-bar-lines . 0)))
(color-theme-taylor)
works... perhaps your problem may have a similar cause...
Something like (progn (require 'color-theme) (color-theme-initialize)) should work. To see (eval-after-load "color-theme" '(progn (color-theme-initialize))) does what it should do, check if color-theme-initialize is appended to after-load-alist (describe-variable C-h v). If not, it could be a bug.