首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >关于如何输入的天真问题-注释了我的ocaml程序。在emacs中

关于如何输入的天真问题-注释了我的ocaml程序。在emacs中
EN

Stack Overflow用户
提问于 2011-06-26 04:38:30
回答 1查看 448关注 0票数 3

我听说我们可以注释ocaml prog。根据它们的类型。论坛上的一个老帖子建议使用http://cristal.inria.fr/~remy/poly/emacs/index.html的ocaml模式

我一直在使用Tuareg模式,该模式建议使用"c-c c-t“来检索类型。tuareg.el中的这段代码

代码语言:javascript
复制
 (when tuareg-with-caml-mode-p
      ;; Trigger caml-types
      (define-key map [?\C-c ?\C-t] 'caml-types-show-type)
      ;; To prevent misbehavior in case of error during exploration.
      (define-key map [(control mouse-2)] 'caml-types-mouse-ignore)
      (define-key map [(control down-mouse-2)] 'caml-types-explore)

我没有定义"c-c,c-t“,尽管一切似乎都配置得很好。

这是.emacs文件

代码语言:javascript
复制
(setq auto-mode-alist
      (cons '("\\.ml[iyl]?$" .  caml-mode) auto-mode-alist))

(autoload 'caml-mode "ocaml" 
  "Major mode for editing Caml code." t)

(autoload 'camldebug "camldebug" 
  "Call the camldebugger on FILE" t)

;; adjust paths for emacs source code
(add-to-list 'load-path "~/my-emacs-config/caml-mode")

;; adjust paths for emacs ocaml info sources
(require 'info)
(add-to-list 'Info-directory-list "~/my-emacs-config/caml-mode")

以下是caml模式下的文件(其中包含ocaml.el)

代码语言:javascript
复制
bash-3.2$ ls ~/my-emacs-config/caml-mode/
caml-compat.el  caml-emacs.el   caml-font.el    caml-help.el    caml-hilit.el   caml-types.el   caml.el     camldebug.el    inf-caml.el ocaml.el

我做了以下工作

--编写阶乘函数。在ocaml中,称为"annot.ml“

代码语言:javascript
复制
let rec f n = 
if n = 1 then 0 else n * f(n-1)

--ocamlc -annot annot.ml

--使用emacs打开annot.ml,并在光标位于"n“下方时按"c-c c-t”。

我进入了emacs的小缓冲区。

代码语言:javascript
复制
c-c c-t undefined

结论,我仍然不能检索类型。为什么?谢谢你的点子。

更多信息:当我尝试M-x caml-tab时,我得到以下列表,其中不包含caml-types-show-types

代码语言:javascript
复制
Possible completions are:
caml-mode              camldebug
camldebug-backtrace        camldebug-break
camldebug-close            camldebug-complete
camldebug-delete           camldebug-display-frame
camldebug-down             camldebug-finish
camldebug-goto             camldebug-kill
camldebug-last             camldebug-mode
camldebug-next             camldebug-open
camldebug-print            camldebug-refresh
camldebug-reverse          camldebug-run
camldebug-step             camldebug-up
EN

回答 1

Stack Overflow用户

发布于 2011-06-26 21:09:10

您正在从ocaml.elocaml.elc自动加载caml-mode。但是没有这样的文件!官方Caml模式在一个名为caml.el的文件中,图阿雷格模式在一个名为tuareg.el的文件中。这解释了为什么打开.ml文件不会将您置于Ocaml模式,也不会加载Caml支持。将您的自动加载更改为使用官方模式

代码语言:javascript
复制
(autoload 'caml-mode "caml" 
  "Major mode for editing Caml code." t)

或者使用Tuareg模式

代码语言:javascript
复制
(autoload 'caml-mode "tuareg" 
  "Major mode for editing Caml code." t)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6480388

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档