Elisp 编程 - 最好的设置是什么?
Emacs 中有各种很酷的编程语言模式,都是用 elisp 编写的,但显然对 elisp 本身没有特殊支持。
由于 slime 不适用于 elisp,我问自己是否所有 elisp 代码都只是在 scratch 缓冲区中被黑了? 编写 elisp 时是否不需要像 slime 这样的东西,或者根本就没有?有人在更大的 elisp 项目中使用 ECB 和语义吗?
There are all kind of cool programming language modes in Emacs, written in elisp, but apparently no special support for elisp itself.
Since slime is not working for elisp, I ask myself if all that elisp code is just hacked in the scratch buffer?
Is there no need for something like slime when writing elisp, or is it simply not there? Is anybody using ECB and semantic for bigger elisp projects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
ielm
是 Emacs Lisp REPL:交互式 Emacs Lisp 模式。Mx ielm 带您到达那里。
ielm
is the Emacs Lisp REPL: Interactive Emacs Lisp Mode.M-x ielm gets you there.
Emacs 本身带有 Emacs Lisp 支持。基础到中级的内容,例如补全 (
M-TAB
)、库搜索 (Mx apropos
)、文档 (Ch f
、Ch v
、Ch S
),即时运行代码(CMx
、M-:
)直接在运行 Emacs。Slime 的主要目的是与外部进程交互。对于 Emacs Lisp,您不需要它(除非您正在为不同版本的 Emacs 进行开发,但这是一个罕见的问题)。
ECB 和语义的功能对于大型项目(由多个源文件组成)最有用。人们不倾向于用 Emacs Lisp 编写大型项目。
Emacs itself comes with Emacs Lisp support. Basic-to-intermediate things like completion (
M-TAB
), library search (M-x apropos
), documentation (C-h f
,C-h v
,C-h S
), running code on-the-fly (C-M-x
,M-:
) operate directly in the running Emacs.Slime's primary purpose is interaction with an external process. You don't need that for Emacs Lisp (unless you're developing for a different version of Emacs, but that's a rare concern).
The features of ECB and semantic are mostly useful for large projects (consisting of more than a handful of source files). People don't tend to write large projects in Emacs Lisp.
总是有 emacs-lisp-mode,它(至少在 Emacs 23 中)会在任何时候自动加载您编辑 .el 文件。这似乎是许多 emacs lisp 黑客用来编写程序的方法。它有一些不错的功能(例如编译或评估缓冲区、一些调试工具、分析)。默认情况下,*scratch* 缓冲区是从 lisp-interaction-mode 编辑的,这有点不同。
它不像 slime 那样功能齐全(elisp 的社区比 common lisp 小得多),但它确实有效。您必须查阅文档并尝试该模式才能了解可以使用哪些功能。
There's always emacs-lisp-mode, which (at least in Emacs 23) is automatically loaded whenever you edit a .el file. This appears to be what many emacs lisp hackers use to write their programs. It has a few nice features (like compiling or evaluating a buffer, some debugging tools, profiling). The *scratch* buffer is by default edited from lisp-interaction-mode, which is a bit different.
It's not quite as full featured as, say, slime (elisp has a much smaller community than common lisp), but it definitely works. You'd have to poke around the documentation and experiment with the mode to see what kind of features you can use.
如前所述,Emacs 已经是权威的 elisp 开发环境,并且在内部为您提供了您可能需要的大部分功能。
如果您想跳转到尚未加载(并且缺少自动加载声明)的函数定义,您也可能使用 ctags/etags 为您的 elisp 代码库生成外部索引。 Mx
find-function
RET 否则处理此问题。 (我将其绑定到 ChCf)“apropos”函数是查找一般内容的关键。我使用以下绑定来轻松访问:
我还启用了 eldoc-mode 并绑定了 imenu-ido-goto-symbol(但很少使用)。
还有其他可能有用的库。例如,我知道有些人非常信赖 ParEdit。诚然,定位搜索对于编写 elisp 有用的 elisp 库有点困难。我不确定 Emacs Wiki 是否有这方面的类别?
As indicated, Emacs is already the definitive elisp development environment, and internally provides you with most of the functionality you are likely to want.
You might potentially also use ctags/etags to generate an external index for your elisp code base, if you were wanting to jump to function definitions which were not already loaded (and lacked autoload declarations). M-x
find-function
RET handles this otherwise. (I bind that to C-hC-f)The "apropos" functions are key to finding things in general. I use the following bindings for easy access:
I also enable
eldoc-mode
and I haveimenu-ido-goto-symbol
bound (but very rarely utilised).There are other libraries that may prove useful. I know that some people swear by ParEdit, for example. Admittedly, it's a bit difficult to target a search for elisp libraries which are useful for writing elisp. I'm not sure if the Emacs Wiki has a category for this?
我通常使用
emacs-lisp-mode
而不是*scratch*
的默认模式。 99% 的时间我都想保存一次性的交互式测试(至少暂时保存),因此我更常使用*.el
文件而不是*scratch*
.Icicles 在与 Emacs Lisp 交互时可以提供很大帮助。方法太多,这里就不一一列举了。以下两个概述可以提供一些想法:
http://www.emacswiki.org/emacs/EmacsNewbieWithIcicles
http://www.emacswiki.org/emacs/Icicles_-_Nutshell_View
I generally use
emacs-lisp-mode
in preference to the default mode for*scratch*
. 99% of the time I want to save even throw-away, interactive tests (at least temporarily), so I more often use a*.el
file than*scratch*
.Icicles can help a lot when interacting with Emacs Lisp. The ways are too numerous to list here. Here are two overviews that can give an idea:
http://www.emacswiki.org/emacs/EmacsNewbieWithIcicles
http://www.emacswiki.org/emacs/Icicles_-_Nutshell_View
我认为将这个添加到您的 .emacs
将会非常有帮助。
I think add this to you .emacs
will be very helpful.
调试功能
我认为这些是 elisp 最好的调试工具。
to debug the function
I think these is the best debug tools for elisp.