在 Emacs24 中突出显示局部变量、对象属性和常量 +欧洲经济与发展中心
我对 Emacs 比较陌生,最近将其设置为开发 C++ 的 IDE(emacs24 + 内置 CEDET + 来自 cvs 的 ECB)。到目前为止,我很享受结果,但我想要一些自定义突出显示,默认情况下似乎不存在。
当我声明一个新的常量、局部变量或对象属性时,它们会以不同的颜色显示。但是,当它们在其他地方使用时,它们会显示为普通文本。我想让常量在声明后在代码中的某个地方使用时以另一种颜色+斜体显示(例如)。
有什么办法可以实现这一点吗?我尝试使用 Cu Cx = 来查看启用的面孔并自定义它们,但它似乎没有注意到我正在使用特殊符号而不是普通文本。 ECB 在其窗口之一中将它们显示为变量或属性。
I'm relatively new to Emacs and I have recently set it up as an IDE to develop C++ (emacs24 + builtin CEDET + ECB from cvs). I am enjoying the results so far but I'd like some custom highlighting which doesn't seem to exist by default.
When I declare a new constant, local variable or object attribute they appear in a different color. However, when they are used somewhere else, they are displayed as normal text. I'd like to make the constants to be displayed in another color + italics (for example) when they are used somewhere in the code after being declared.
Is there any way to achieve that? I have tried to C-u C-x =
to see the enabled faces and customize them, but it doesn't seem to notice that I'm over a special symbol and not ordinary text. ECB displays them as variables or attributes in one of its windows.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当声明变量时,着色是通过字体锁定完成的,并且与声明的语法有关。变量或函数的使用是模糊的并且无法真正被识别。
如果您指的是允许您以某种方式为标签着色的参议员菜单项,则只会为该标签着色。它不知道如何追踪事件的发生。要跟踪事件的发生,您需要使用
semantic-symref
或类似的工具,可能需要使用更高级的后端,例如GNU Global。您可以使用
semantic-idle-local-symbol-highlight
启用一种有用的模式,该模式将为您所在的符号进行特殊突出显示,但它与您正在寻找的内容并不真正匹配。When you declare a variable, the coloring is done with font-lock, and is related to the syntax of the declaration. Uses of a variable or function are indistinct and can't really be identified.
If you are referring to the Senator menu item that lets you color a tag in some way, that only colors that tag. It doesn't know how to track the occurances down. To track occurances, you need to use
semantic-symref
or similar tool, probably with a more advanced back-end like GNU Global.There is a useful mode you can enable with
semantic-idle-local-symbol-highlight
that will do special highlighting for the symbol you are on, but it doesn't really match what you are looking for.