Emacs 定义无效:use-package

hea*_*ck1 0 emacs

我有个问题。如果我复制任何官方代码以将此类 elpy 打包到我的配置中,我会得到:

符号的函数定义无效:use-package

(use-package elpy
  :ensure t
  :init
  (elpy-enable))
Run Code Online (Sandbox Code Playgroud)

小智 6

请在使用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)
Run Code Online (Sandbox Code Playgroud)