Haskell Emacs haskell-模式:运行 'C-h f haskell-mode' 用于说明如何设置 Haskell 交互模式
Haskell Emacs haskell-mode: Run 'C-h f haskell-mode' for instruction how to setup a Haskell interaction mode
我正在学习 https://learnhaskell.blogspot.com/2007/09/lesson-1-hello-world.html
中的教程
我按照所有说明操作,但在 emacs 上输入 C-c C-l
时,我得到 Run 'C-h f haskell-mode' for instruction how to setup a Haskell interaction mode
当我输入时,它会打开一个不是很有用的页面。
接下来我该做什么?除了删除 ghi, emacs
和 apt
的版本号外,我完全按照教程中的步骤进行操作。
我的.emacs
文件如下,和博客里的一模一样
;; Font Locking, Programming Modes, and Compilation settings
;;
(global-font-lock-mode 1)
;; maximum colors
(setq font-lock-maximum-decoration t)
;; extra key bindings
(global-set-key "\M-C" 'compile)
(global-set-key "\C-^" 'next-error)
(global-set-key "\C-\M-g" 'goto-line)
;; use spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; haskell mode configuration
(setq auto-mode-alist
(append auto-mode-alist
'(("\.[hg]s$" . haskell-mode)
("\.hic?$" . haskell-mode)
("\.hsc$" . haskell-mode)
("\.chs$" . haskell-mode)
("\.l[hg]s$" . literate-haskell-mode))))
(autoload 'haskell-mode "haskell-mode"
"Major mode for editing Haskell scripts." t)
(autoload 'literate-haskell-mode "haskell-mode"
"Major mode for editing literate Haskell scripts." t)
;adding the following lines according to which modules you want to use:
(require 'inf-haskell)
(add-hook 'haskell-mode-hook 'turn-on-font-lock)
;(add-hook 'haskell-mode-hook 'turn-off-haskell-decl-scan)
;(add-hook 'haskell-mode-hook 'turn-off-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
;(add-hook 'haskell-mode-hook 'turn-on-haskell-hugs)
(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
(add-hook 'haskell-mode-hook
(function
(lambda ()
(setq haskell-program-name "ghci")
(setq haskell-ghci-program-name "ghci6"))))
必须启用 minor-mode interactive-haskell-mode
才能在 Haskell 代码缓冲区和 Haskell 解释器之间打开交互式会话。您可以使用命令 M-x interactive-haskell-mode
.
为当前缓冲区启用此模式
要为您打开的每个 Haskell 文件启用此模式,您可以设置一个 haskell-mode
挂钩,它将 运行 此命令(即启用 interactive-haskell-mode
)每次启用 haskell-mode
。应将以下行添加到您的 .emacs 文件中:
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
我正在学习 https://learnhaskell.blogspot.com/2007/09/lesson-1-hello-world.html
中的教程我按照所有说明操作,但在 emacs 上输入 C-c C-l
时,我得到 Run 'C-h f haskell-mode' for instruction how to setup a Haskell interaction mode
当我输入时,它会打开一个不是很有用的页面。
接下来我该做什么?除了删除 ghi, emacs
和 apt
的版本号外,我完全按照教程中的步骤进行操作。
我的.emacs
文件如下,和博客里的一模一样
;; Font Locking, Programming Modes, and Compilation settings
;;
(global-font-lock-mode 1)
;; maximum colors
(setq font-lock-maximum-decoration t)
;; extra key bindings
(global-set-key "\M-C" 'compile)
(global-set-key "\C-^" 'next-error)
(global-set-key "\C-\M-g" 'goto-line)
;; use spaces instead of tabs
(setq-default indent-tabs-mode nil)
;; haskell mode configuration
(setq auto-mode-alist
(append auto-mode-alist
'(("\.[hg]s$" . haskell-mode)
("\.hic?$" . haskell-mode)
("\.hsc$" . haskell-mode)
("\.chs$" . haskell-mode)
("\.l[hg]s$" . literate-haskell-mode))))
(autoload 'haskell-mode "haskell-mode"
"Major mode for editing Haskell scripts." t)
(autoload 'literate-haskell-mode "haskell-mode"
"Major mode for editing literate Haskell scripts." t)
;adding the following lines according to which modules you want to use:
(require 'inf-haskell)
(add-hook 'haskell-mode-hook 'turn-on-font-lock)
;(add-hook 'haskell-mode-hook 'turn-off-haskell-decl-scan)
;(add-hook 'haskell-mode-hook 'turn-off-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
;(add-hook 'haskell-mode-hook 'turn-on-haskell-hugs)
(add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
(add-hook 'haskell-mode-hook
(function
(lambda ()
(setq haskell-program-name "ghci")
(setq haskell-ghci-program-name "ghci6"))))
必须启用 minor-mode interactive-haskell-mode
才能在 Haskell 代码缓冲区和 Haskell 解释器之间打开交互式会话。您可以使用命令 M-x interactive-haskell-mode
.
要为您打开的每个 Haskell 文件启用此模式,您可以设置一个 haskell-mode
挂钩,它将 运行 此命令(即启用 interactive-haskell-mode
)每次启用 haskell-mode
。应将以下行添加到您的 .emacs 文件中:
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)