emacs - 如何使 haskell 模式包与 Nixos 上的 Emacs 一起使用?

标签 emacs haskell-mode nixos nix

我使用 configuration.nix 以某种方式安装 emacshaskellMode 包:

environment.systemPackages = with pkgs; [
  (haskellPackages.ghcWithPackages (self : [
     self.cabalInstall
     self.happy
     self.alex
     self.ghcMod
  ]))
  emacs
  emacs24Packages.haskellMode
];

我的 .emacs 文件包含:

(require 'haskell-mode)
(add-hook 'haskell-mode-hook 'turn-on-hi2)

Emacs 然后启动,没有错误(所以我假设它可以找到 haskell-mode),但当我打开 .hs 时,它不会进入 Haskell 次要模式> 文件。

~/.nix-profile/share/emacs/site-lisp/haskell-.... 文件确实存在于我的个人资料中,如果重要的话...

那么,我该如何让它发挥作用呢?

最佳答案

我在尝试使用 haskell-indent 而不是 hi2 时遇到了同样的问题。 无论如何,通过执行 M-x haskell-mode RET 得到的输出会警告 haskell 字体锁丢失。

通过声明您(需要'haskell-font-lock)来解决此问题。

如果您的 .emacs 文件包含以下内容:

(require 'haskell-mode) (add-hook 'haskell-mode-hook 'turn-on-hi2)

您应该添加 (require 'hi2) 因为它指向 here .

(require 'haskell-mode)
(require 'haskell-font-lock)
(require 'hi2)
(add-hook 'haskell-mode-hook 'turn-on-hi2)

请注意,haskell-mode 包不提供 hi2.el。

希望这有帮助!

关于emacs - 如何使 haskell 模式包与 Nixos 上的 Emacs 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29430694/

相关文章:

emacs - 当没有可保存的内容时更新选项卡栏

Emacs:桌面不检索框架名称

haskell - Emacs 的 Haskell 缩进模式有何异同?

nixos - 恢复意外删除的 configuration.nix 文件

linux - 空输入字符垃圾邮件 Linux tty

emacs在一个大项目中的项目中查找文件

git - 比较 MAGIT 中两个不同分支的 foo.bar

haskell - Haskell 模式的默认缩进设置可以吗?

haskell - 如何设置 haskell-mode 来生成标签?

nixos - 如何在不抛出 `cannot coerce a set to a string` 的情况下覆盖 Nix 导数?