简体   繁体   English

具有多个参数的定义中的Emacs字体锁定功能名称

[英]Emacs font-lock function name in definitions with more than one parameter

(Emacs 23.4.1) (Emacs 23.4.1)

I'm looking for a solution to where the color of the function name turn to regular text whenever the function parameterlist is equal to, or above 2 arguments. 我正在寻找一种解决方案,只要函数参数列表等于或大于2个参数,函数名称的颜色就会变为常规文本。

So functions that takes 0 or 1 argument, have the nice color which I've set in my .emacs file. 因此,接受0或1参数的函数具有我在.emacs文件中设置的漂亮颜色。

Why doesn't functions with >= 2 arguments get that? 为什么带有> = 2个参数的函数不能得到那个?

Here is my .emacs custom-set-face : 这是我的.emacs custom-set-face

    (custom-set-faces
     '(default ((t (:background "#F9F9F7" :family "liberation mono"))))
     '(font-lock-builtin-face ((t (:foreground "#5B5B5B"))))
     '(font-lock-comment-face ((t (:foreground "#afaf9d"))))
     '(font-lock-constant-face ((t (:foreground "#2caeae"))))
     '(font-lock-function-name-face ((t (:bold t :foreground "#931616"))))
     '(font-lock-keyword-face ((t (:bold t :foreground "#35363a"))))
     '(font-lock-negation-char-face ((t (:bold t))))
     '(font-lock-reference-face ((t (:foreground "#cbcbcb"))))
     '(font-lock-string-face ((t (:foreground "#e80000"))))
     '(font-lock-type-face ((t (:bold t :foreground "#3f4d7f"))))
     '(font-lock-variable-name-face ((t (:foreground "#35363a"))))
     '(font-locl-preprocessor-face ((t (:foreground "#cbcbcb"))))
    )

Not sure I understand your question. 不确定我是否理解您的问题。 But I think it is something like this: 但我认为是这样的:

Font-lock does not highlight function names in function definitions, if the function takes more than one parameter. 如果函数采用多个参数,则字体锁不会在函数定义中突出显示函数名称。

Is that it? 是吗

If so, then you need to specify what language the code is in, and give and example of a function definition with > 1 parameter that does not highlight correctly. 如果是这样,那么您需要指定代码使用的语言,并给出一个带有> 1个不能正确突出显示的参数的函数定义的示例。 And morst importantly, give the value of font-lock-keywords (at least the part of it that pertains to font-lock-function-name-face ). 而且最重要的是,给出font-lock-keywords的值(至少其中一部分与font-lock-function-name-face )。

If I understand your question, customizing faces should have no effect, so you can remove that code from your question. 如果我理解您的问题,自定义面孔将没有任何作用,因此您可以从问题中删除该代码。

Finally, do you see the problem when you start Emacs using emacs -Q , that is, without using your init file? 最后,当您使用emacs -Q启动Emacs时,即不使用初始化文件时,是否看到问题? If not, then assume that you are doing something in your init file ( ~/.emacs ) that is causing the problem. 如果不是,则假定您在初始化文件( ~/.emacs )中正在执行导致问题的操作。 In that case, bisect it recursively to narrow it down to find the culprit part. 在这种情况下,将其二等分以递归将其缩小以找到罪魁祸首。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM