在Emacs下可以使用caml模式下的tuareg字体吗? [英] Is it possible to use the font of tuareg in caml-mode under Emacs?
问题描述
对于缩进if,我必须使用 Caml-mode
在Emacs下。
For Indentation of "if", i have to use caml-mode
under Emacs.
但是我发现 tuareg
比 caml-font
更加多彩,所以我的问题是是否可以使用 tuareg
在 caml-mode
。
But I find the font of tuareg
is more colorful than caml-font
, so my question is whether it is possible to use the font of tuareg
in caml-mode
.
另外,使用当前的。emacs 需要 caml-font
,当我打开一个 .ml
文件,一些行(特别是在文件的开头)不突出显示。如果我去那些行,修改它们,他们会改变他们的颜色。有没有人会告诉我如何解决这个问题?
Also, with the current .emacs which requires caml-font
, when I open a .ml
file, some lines (especially in the beginning of the file) are not highlighted. If I go to those lines, modify them, they will change their color. Could anyone tell me how to fix that problem?
另外,除了 tuareg之外,还有一些更好的ocaml程序的字体
和 caml-font
?
非常感谢!
推荐答案
你的意思是你喜欢的颜色更好或更多的颜色?
Do you mean that you like the colors better or that their are more colors?
如果是后者,可能很难用caml模式使用tuareg字体锁定,虽然我只看了一下这两个。
If the latter, it's probably difficult to use tuareg font-locking with caml-mode, though I only looked at the two a little bit.
如果是前者,您可以简单地自定义 caml-mode
使用的脸部,以使用更好的脸部(我的意思是字体或颜色)。使用足够新的emacs,将光标放在要更改的面上,然后键入 M-x custom-face RET
。它会建议你所在的脸的名字,所以再次返回。然后你可以以任何你想要的方式改变脸部。作为第一步,您可以保持 tuareg.el
打开并检查所在的脸,例如
If it's the former, you can simply customize the faces used by caml-mode
to use better faces (by which I mean typeface or "color"). With a sufficiently new emacs, put your cursor on the face that you want to change and type M-x customize-face RET
. It will suggest the name of the face that you are on, so hit return again. Then you can change the face in any way you want. As a first step you might keep tuareg.el
open and check what faces are there, for example
(defface tuareg-font-lock-governing-face
'((((background light)) (:foreground "blue" :bold t))
(t (:foreground "orange" :bold t)))
"Face description for governing/leading keywords."
:group 'tuareg-faces)
是用于let的脸的定义,所以你只需把你的光标放在let, Mx自定义面RET RET
,然后将前景更改为蓝色并打开粗体(假设您有浅色背景)。不要忘记保存它。
is the definition of the face used for let, so you would just put your cursor on let, M-x customize-face RET RET
, then change the foreground to blue and turn on bold (assuming you have a light background). Don't forget to save it.
或者,您可以编辑 caml-font.el
并更改 caml-font-lock-keywords
部分使用您喜欢的字体(可能来自tuareg)。如果要添加到 .emacs
,那么您应该将其更改为(setq caml-font-lock-keywords ...)
。
Alternately, you can edit caml-font.el
and change the caml-font-lock-keywords
section to use the fonts you like (which could be from tuareg). If you want to add to your .emacs
instead then you should change it to (setq caml-font-lock-keywords ...)
.
(defconst caml-font-lock-keywords
(list
...
;definition
(cons (concat
"\\<\\(a\\(nd\\|s\\)\\|c\\(onstraint\\|lass\\)"
"\\|ex\\(ception\\|ternal\\)\\|fun\\(ct\\(ion\\|or\\)\\)?"
"\\|in\\(herit\\|itializer\\)?\\|let"
"\\|m\\(ethod\\|utable\\|odule\\)"
"\\|of\\|p\\(arser\\|rivate\\)\\|rec\\|type"
"\\|v\\(al\\(ue\\)?\\|irtual\\)\\)\\>")
;; 'font-lock-type-face)
'tuareg-font-lock-governing-face)
...
))
这篇关于在Emacs下可以使用caml模式下的tuareg字体吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!