I am going to organize my .emacs file to better keep track of everything that I add to it.
At the same time, I encountered an error described in the title, and I do not know exactly why
Here is my .emacs file: (loading comments for my reference)
;;;; Emacs config file ;; convenience function for loading multiple libs in a single call (defun load-libs (&rest libs) (dolist (lib libs) (load-library lib))) ;; path to custom libraries as well as the libraries themselves (add-to-list 'load-path "~/.emacs.d/lisp/") (load-libs "convenience" "editor-behaviour") ;; Add support for the package manager (require 'package) ;; Add various package archives (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") '("melpa" . "http://melpa.milkbox.net/packages/")) ;; Installs packages if they aren't already (package-refresh-and-install ; from convenience.el 'scala-mode2 'sbt-mode 'haskell-mode 'geiser 'auto-complete 'ac-geiser 'cider) ;; Initialise packages (package-initialize) ;; libs dependent on the packages being initialized go here (load-library "autocomplete-config") ;; Enable Haskell indentation (custom-set-variables '(haskell-mode-hook '(turn-on-haskell-indentation)))
Running emacs .emacs --debug-init gives me the following result:
Debugger entered--Lisp error: (error "package.el is not yet initialized!") signal(error ("package.el is not yet initialized!")) error("package.el is not yet initialized!") package-installed-p(scala-mode2) (if (package-installed-p pkg) nil (package-refresh-contents) (package-install pkg)) (while --dolist-tail-- (setq pkg (car --dolist-tail--)) (if (package-installed-p pkg) $ (let ((--dolist-tail-- pkgs) pkg) (while --dolist-tail-- (setq pkg (car --dolist-tail-$ package-refresh-and-install(scala-mode2 sbt-mode haskell-mode geiser auto-complete ac-$ eval-buffer(#<buffer *load*> nil "/Users/ElectricCoffee/.emacs" nil t) ; Reading at $ load-with-code-conversion("/Users/ElectricCoffee/.emacs" "/Users/ElectricCoffee/.emacs$ load("~/.emacs" tt) #[0 "^H\205\262^@ \306=\203^Q^@\307^H\310Q\202;^@ \311=\204^^^@\307^H\312Q\202;^@\$ command-line() normal-top-level()
Which suggests (in my opinion) that this has something to do with convenience.el , but all of this is there:
(defun package-refresh-and-install (&rest pkgs) "Utility function to refresh package contents and install several packages at once" (dolist (pkg pkgs) (unless (package-installed-p pkg) (package-refresh-contents) (package-install pkg))))
So I'm not quite sure where I am making a mistake here ... Any help?
emacs elisp
Electric coffee
source share