【发布时间】:2013-08-31 15:06:30
【问题描述】:
我正在尝试学习如何编写 emacs 主要模式。网上有很多很棒的教程(例如http://www.emacswiki.org/emacs/GenericMode),但我正在努力学习正则表达式匹配的语法。例如,from this answer 我试图理解为什么
'(("\"\\(\\(?:.\\|\n\\)*?[^\\]\\)\""
来自
(define-derived-mode rich-text-mode text-mode "Rich Text"
"text mode with string highlighting."
;;register keywords
(setq rich-text-font-lock-keywords
'(("\"\\(\\(?:.\\|\n\\)*?[^\\]\\)\"" 0 font-lock-string-face)))
(setq font-lock-defaults rich-text-font-lock-keywords)
(font-lock-mode 1))
匹配双引号之间的任何内容。本素材:http://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Special.html#Regexp-Special 似乎没有解释。
那里有更好的资源吗?
【问题讨论】:
-
当呈现一个节点“Regexp-Special”时,它显然涵盖了一些特殊情况,您应该能够向上查看“Regexps 的语法”,而不是对试图提供帮助的人投反对票。跨度>
标签: regex emacs syntax elisp major-mode