mode cannot handle backquoted backslashes

Currently Emacs https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode cannot correctly highlight

``

because it doesn't understand that single backslashes are self-contained in such a raw string literal.

I believe this extract from d-mode.el

(defvar d-mode-syntax-table nil
  "Syntax table used in d-mode buffers.")
(or d-mode-syntax-table
    (setq d-mode-syntax-table
     (let ((table (funcall (c-lang-const c-make-mode-syntax-table d))))
       ;; Make it recognize D `backquote strings`
       (modify-syntax-entry ?` """ table)

       ;; Make it recognize D's nested /+ +/ comments
       (modify-syntax-entry ?+  ". 23n"   table)
       table)))

is highly related to this problem. Ideas on how to fix this anyone?

See also: http://forum.dlang.org/post/kqzbgawuzyemcyjnsuin@forum.dlang.org


What Jon O. says: use a syntax-propertize-function . Eg

(setq-local syntax-propertize-function
            (syntax-propertize-rules ("`(\)`" (1 "."))))

Fix已经被提交到Git仓库,所需的Emacs最低为24.3,这已经在Debian Sid上测试过了。

链接地址: http://www.djcxy.com/p/80636.html

上一篇: 内容脚本中的Firefox SDK访问首选项

下一篇: 模式不能处理反引号的反斜杠