简体   繁体   English

Emacs在haskell模式下挂起,带有inferior-haskell-load-file调用

[英]Emacs hangs in haskell-mode with inferior-haskell-load-file call

When in a Haskell file, I use Cc Cl to run the command inferior-haskell-load-file which is intended to load the current file into the GHCI interpreter but Emacs just hangs until I hit Cg . 在Haskell文件中,我使用Cc Cl来运行命令inferior-haskell-load-file ,该命令用于将当前文件加载到GHCI解释器中,但Emacs只是挂起,直到我点击Cg Anyone know how I can get this to work? 谁知道我怎么能让这个工作?

GNU Emacs 23.3.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.5) of 2011-08-14 on allspice, modified by Debian 2011-08-14关于五香粉的GNU Emacs 23.3.1(x86_64-pc-linux-gnu,GTK +版本2.24.5),由Debian修改

Using haskell-mode version v2.7.0 使用haskell-mode版本v2.7.0

inferior-haskell-mode does some parsing based upon the expected ghci prompt. inferior-haskell-mode根据预期的ghci提示进行一些解析。 As such, if you change the prompt in a .ghci file, then it can't detect it. 因此,如果更改.ghci文件中的提示,则无法检测到它。

For more information, see where haskell-ghci.el sets the comint-prompt-regexp value to determine what a prompt is . 有关更多信息,请参阅haskell-ghci.el设置comint-prompt-regexp值以确定提示的位置

;; GHCi prompt should be of the form `ModuleName> '.
(setq comint-prompt-regexp
      "^\\*?[[:upper:]][\\._[:alnum:]]*\\( \\*?[[:upper:]][\\._[:alnum:]]*\\)*> ")

If you want to keep the setting in your .ghci file, then it may be possible to customise this settings. 如果要将设置保留在.ghci文件中,则可以自定义此设置。

Old question, but as I just ran into this today, I wanted to share how to actually customize comint-prompt-regexp since I had to figure it out. 老问题,但正如我今天遇到的那样,我想分享如何实际定制comint-prompt-regexp因为我必须弄明白。

This customization will recognize λ> prompts, or actually any single character before > ), but it doesn't break the existing regex. 此自定义将识别λ>提示,或实际上> )之前的任何单个字符,但它不会破坏现有的正则表达式。 In your .emacs : 在你的.emacs

(load-library "inf-haskell")

(defun my-inf-haskell-hook ()
  (setq comint-prompt-regexp 
        (concat comint-prompt-regexp "\\|^.> ")))

(add-to-list 'inferior-haskell-mode-hook 'my-inf-haskell-hook)

You can add more dots to "\\\\|^.> " to recognize a longer prompt, but I wanted to keep it fixed-length for simplicity. 您可以向"\\\\|^.> "添加更多点以识别更长的提示,但为了简单起见,我希望保持固定长度。

I got the same error message when I tried to use stack with emacs. 当我尝试使用与emacs的堆栈时,我收到了相同的错误消息。 For me, adding this line to my .emacs/init.el resolved the problem: 对我来说,将这一行添加到我的.emacs / init.el解决了这个问题:

(setq haskell-program-name "stack ghci")

I had a similar problem caused by GHCi reporting some kind of error on startup, causing the Emacs haskell mode to wait for the GHCi prompt indefinitely (GHCi didn't show the standard prompt ( Prelude> ), but rather just showed > ). 我有一个类似的问题,GHCi在启动时报告某种错误,导致Emacs haskell模式无限期地等待GHCi提示(GHCi没有显示标准提示( Prelude> ),而只是显示> )。 You can try running GHCi externally and see if it reports any errors. 您可以尝试在外部运行GHCi,看看它是否报告任何错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM