哈斯克尔在自动完成GNU / Emacs的 [英] Haskell autocompletion in GNU/Emacs

查看:165
本文介绍了哈斯克尔在自动完成GNU / Emacs的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装在Emacs哈斯克尔模式。然后,我写在我的.emacs:

I installed haskel-mode in emacs. Then I write in my .emacs:

(load "~/.emacs.d/haskell-mode/haskell-site-file")
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
(add-hook 'haskell-mode-hook 'haskell-font-lock-symbols t)
(put 'downcase-region 'disabled nil)

我必须在Emacs中可以自动完成对哈斯克尔我的conf文件中添加什么?哈斯克尔或模式有没有这样的可能性?

What must i add in my conf file that emacs could autocomplete for Haskell ? Or Haskell mode there is no such possibility?

感谢您

推荐答案

在没有特定语言的支持,您可以使用代码。这是一个通用的完成机制。

When there is no language-specific support, you can use tags. This is a generic completion mechanism.


  1. 生成一个标记文件,其中包含标识符的列表以及它们被定义。 Emacs中自带的的ETag 程序来做这个在许多语言,但不是哈斯克尔; GHC带有 hasktags

  1. Generate a TAGS file, which contains a list of identifiers and where they are defined. Emacs comes with the etags program to do this in many languages, but not Haskell; ghc comes with hasktags.

加载标记文件的Mx访问-标签表

标签都没有上下文相关的,所以他们会到处乱提示类型,值,构造等。他们也不会提供先进的功能,如容易呈现出值的类型。最重要的标签的命令是:

Tags are not context-dependent, so they'll indiscriminately suggest types, values, constructors, etc everywhere. They also won't provide advanced features such as easily showing the type of a value. The most important tags commands are:


  • M-TAB 完整的符号)根据标记加载列表完成的标识符

  • M-TAB (complete-symbol) completes an identifier according to the loaded list of tags.

M - 找到标签)去哪里点标识符是地方定义,若必要打开包含文件

M-. (find-tag) goes to the place where the identifier at point is defined, opening the containing file if necessary.

米 - * 弹出标签标记)可以追溯到你在哪里之前 M -

M-* (pop-tag-mark) goes back where you were before M-..

M-X标签,中肯显示匹配的正则表达式的标识符列表。

M-x tags-apropos shows a list of identifiers matching a regexp.

有关更多信息,请查看在Emacs手册标签。

For more information, look under "Tags" in the Emacs manual.

有关更较粗略,但全自动机制,还有就是动态缩写的功能。 C-米 - / dabbrev-完成)看起来对完成最开放的缓冲区;这是完全独立于语言的,所以它甚至会在字符串,注释,无论找到的话。 M - / dabbrev-展开)是相似的,而是直接完成对点之前最接近的匹配

For an even cruder, but fully automatic mechanism, there is the dynamic abbrev feature. C-M-/ (dabbrev-completion) looks in most open buffers for a completion; this is completely language-independent, so it'll even find words in strings, comments, whatever. M-/ (dabbrev-expand) is similar, but directly completes to the nearest match before point.

这篇关于哈斯克尔在自动完成GNU / Emacs的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆