gpt4 book ai didi

Emacs:无法自动启动通过 MELPA 安装的弹丸

转载 作者:行者123 更新时间:2023-12-04 18:41:40 25 4
gpt4 key购买 nike

我对emacs相当陌生。事实上,我正在学习编辑器并尝试设置一些可以复制“转到项目内的文件”功能的东西,这些功能来自 Code::Blocks 或 notepad++ 的某些插件。

'projectile' 满足了这个需求,我通过 MELPA 安装了它。软件包安装正确,因为我可以使用 M-x projectile-global-mode 启动它和 C-c p命令被识别。

但是,如果我将其放入我的 .emacs文件,Emacs 以错误开始:

Symbol's function definition is void: projectile-global-mode

我的 .emacs 的内容文件如下:
(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-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.
)
(global-whitespace-mode 1)
(global-linum-mode 1)

(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)

(projectile-global-mode 1)

当我尝试 (require 'projectile)首先,我只得到另一个错误:
 'File error: Cannot open load file, projectile'

我正在使用 Emacs 24.3.1。

如何正确地将其设置为自动启动?

最佳答案

默认情况下,Emacs 初始化包 之后 评价 init.el .因此,在标准设置中,软件包尚不可用,而 init被评估。

使用(add-hook 'after-init-hook #'projectile-global-mode)仅在包初始化后启用 Projectile,或在 init.el 开头显式初始化包使用以下代码:

(require 'package)
(setq package-enable-at-startup nil) ; To avoid initializing twice
(package-initialize)

关于Emacs:无法自动启动通过 MELPA 安装的弹丸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24610945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com