Emacs单引号字符串中的泛型模式被突出显示

时间:2018-06-06 12:30:09

标签: emacs

简单的问题,我在Emacs中使用泛型模式进行颜色编码。除了使用"'可以用来表示'this is a string'"this is a string"中的字符串之外,以下内容效果很好。默认情况下,在通用模式下," hightlighted" ,但'不是'

(require 'generic-x)

 (define-generic-mode
      'foo-mode                         ;; name of the mode to create
      '("#")                           ;; comments start with '!!'
      '("for" "if" "else"  )                     ;; some keywords
      '(("=" . 'font-lock-operator)     ;; '=' is an operator
        ("+" . 'font-lock-operator)     ;; '=' is an operator
        ("-" . 'font-lock-operator)     ;; '=' is an operator
        ("'" . 'font-lock-builtin)     ;; '=' is an operator
        ("<-" . 'font-lock-operator)     ;; '=' is an operator
        ("*" . 'font-lock-operator)     ;; '=' is an operator
        ("/" . 'font-lock-operator)     ;; '=' is an operator
        ("," . 'font-lock-builtin)     ;; ';' is a built-in
        (";" . 'font-lock-builtin))     ;; ';' is a built-in
      '("\\.myext$")                      ;; files for which to activate this mode
       nil                              ;; other functions to call
      "A generic mode for myext files"            ;; doc string for this mode
    )

是否有一种简单的方法可以将上述处理作为&#34; s?

1 个答案:

答案 0 :(得分:1)

您最好遵循Stefans的建议并使用define-derived-mode,但由于这个问题是我第一次听说generic.el,我很好奇,不得不找到方法。

在我的测试中,删除font-lock-keyword的{​​{1}}条目并修改函数列表中函数(')中'的语法表条目似乎工作。

我测试的完整代码:

'(lambda () (modify-syntax-entry ?' "\""))