【问题标题】:Projectile not working anymore. How can I reenable it?弹丸不再工作。我怎样才能重新启用它?
【发布时间】:2025-12-07 05:35:01
【问题描述】:

当我现在启动 emacs 时,prelude 不再激活。这是我的personal.el 文件:

(setq-default tab-width 4)
(setq tab-width 4)
(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.
 '(tab-stop-list (quote (4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100 104 108 112 116 120))))
(setq exec-path (append exec-path '("/usr/bin/")))
(setq auto-fill-mode -1)
(setq-default fill-column 99999)
(setq fill-column 99999)
(setq global-hl-line-mode -1)
(require 'projectile)

(defun myprojectilehook ()
  (projectile-mode)
)

(add-hook 'find-file-hook 'myprojectilehook)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))

我尝试为 find-file-hook 添加一个钩子,这将为当前缓冲区启用弹丸,但没有太大成功。当我打开 emacs 弹丸被禁用。当我访问一个新文件时,弹丸仍然被禁用。我做错了什么?

【问题讨论】:

    标签: emacs projectile emacs-prelude


    【解决方案1】:

    还有一个projectile-global-mode 可以在任何有项目上下文的地方激活 Projectile。 projectile-global-mode 在 Prelude 中默认激活,所以我猜真正的问题与您的 Prelude 设置有关。无论如何:

    (projectile-global-mode +1)

    应该为你的所有项目无条件地启用射弹。请记住,对于 projectile 不认为是项目的目录中的缓冲区,projectile 将始终被禁用(除非您在其中添加 .projectile 文件以标记项目的根文件夹)。

    附:我是 Prelude 和 Projectile 的作者,因此请随意在此处或在其各自的问题跟踪器 GitHub 上发布有关 Prelude 和 Projectile 问题的更多详细信息。

    【讨论】:

      【解决方案2】:

      请注意,在 Emacs 24 之前,(projectile-mode)切换该模式(就像使用 M-x projectile-mode 调用它一样)。如果它处于打开状态,则会将其关闭。

      假设它使用标准模式定义宏,(projectile-mode 1) 将启用,(projectile-mode -1) 禁用。

      C-h f projectile-mode 应该指出这一点。

      【讨论】:

        最近更新 更多