【发布时间】:2011-07-14 08:48:50
【问题描述】:
GNU Emacs 23.2.1
Fedora xfce 14
我开始接触 Prolog,我想使用我的 emacs 作为在 Prolog 中编程的 IDE。
目前我在 c/c++ 中使用 emacs。但不确定如何开始使用 Prolog。我知道 emacs 有一个用于在 emacs 中编程的内置库。然而,我研究发现它的功能较少,即没有语法高亮、缩进等。
所以我已经下载了 emacs prackage Prolog.el。我已经使用M-X Load-library 加载了这个库。
但是,我不确定在那之后该怎么做。如何编译我的序言文件?在 emacs IDE 的菜单中,Prolog 没有任何内容。
我是否还需要为 Prolog 下载一些解释器或编译器?是否有用于编译的 emacs 命令?我通常在编译 c 代码时在 emacs 中使用 make。
我做了一个 yum 搜索序言并得到了这些结果,那么在所有这些选择中,我需要哪一个?:
gprolog.x86_64 : GNU Prolog is a free Prolog compiler
pl.x86_64 : SWI-Prolog - Edinburgh compatible Prolog compiler
pl-static.x86_64 : Static library for SWI Prolog
ppl-gprolog.x86_64 : The GNU Prolog interface of the Parma Polyhedra Library
ppl-gprolog-static.x86_64 : The static archive for the GNU Prolog interface of the Parma Polyhedra Library
ppl-swiprolog.x86_64 : The SWI-Prolog interface of the Parma Polyhedra Library
ppl-swiprolog-static.x86_64 : The static archive for the SWI-Prolog interface of the Parma Polyhedra Library
ppl-yap.x86_64 : The YAP Prolog interface of the Parma Polyhedra Library
yap.i686 : High-performance Prolog Compiler
yap.x86_64 : High-performance Prolog Compiler
非常感谢您的任何建议,
=================== 编辑=====================
我已经安装了以下pl.x86_64
我已经下载了 prolog.el 并将其放在以下目录:
~/.emacs.d/site-lisp/prolog/prolog.el
我已经使用以下配置了我的 emacs:
;;; Prolog mode
(setq load-path (cons "~/.emacs.d/site-lisp/prolog/prolog.el" load-path))
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
(autoload 'prolog-mode "prolog" "Major mode for editing prolog programs." t)
(setq prolog-system 'swi) ; prolog-system below for possible values
(setq auto-mode-alist (append '(("\\.pl$" . prolog-mode))
auto-mode-alist))
因此,当我将文件另存为 *.pl 时,我会看到 prolog 菜单选项。
所以我写了一些序言代码,然后从序言菜单中选择Run interactive prolog session
我打开了第二个空白缓冲区,上面写着(Inferior Prolog:run Shell-Compile)
但是,我不确定现阶段需要做什么。如何编译和运行 prolog 文件?
非常感谢您的进一步支持。
【问题讨论】:
-
附带说明:我不确定您对内置 prolog-mode 的印象从何而来。也许你读过一些关于非常旧版本的 Emacs 的内容。在当前版本中,它确实支持语法高亮和缩进。您可能会发现您下载的备用包实际上可能已经过时,并且内置模式已经变得比现在更好。