Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs: Symbol's function definition is void: use-package

I'm trying to configuring Emacs on Windows and there is one package "use-package" which I wanna to insert in this on my configuration, but when I press to execute on Emacs show the message "Symbol's function definition is void: use-package"

(setq inhibit-startup-message t)

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/"))

(package-initialize)


(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

Sometimes I receive error message "use-package is unavailable."

    Debugger entered--Lisp error: (void-function package-installed-p)
    (package-installed-p (quote use-package))
    (if (package-installed-p (quote use-package)) nil (package-refresh-contents) (package-install (quote use-package)))
    eval((if (package-installed-p (quote use-package)) nil (package-refresh-contents) (package-install (quote use-package))) nil)
    elisp--eval-last-sexp(nil)
    eval-last-sexp(nil)
    funcall-interactively(eval-last-sexp nil)
    call-interactively(eval-last-sexp nil nil)
    command-execute(eval-last-sexp)
like image 309
glashunti Avatar asked Jan 24 '18 16:01

glashunti


1 Answers

You should be able to find use-package in the list produced with M-x package-list-packages. If that is the case, then (package-install 'use-package) should succeed: the package is available on MELPA.

To use it, you have to add

(require 'use-package)

to your .emacs (or equivalent).

like image 82
NickD Avatar answered Nov 15 '22 03:11

NickD