我正在嘗試學習如何編寫emacs主模式。網上有很多很棒的教程(例如http://www.emacswiki.org/emacs/GenericMode),但我很努力學習正則表達式匹配的語法。例如,from this answer我試圖理解爲什麼主要模式的lisp emacs正則表達式
'(("\"\\(\\(?:.\\|\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」,它明顯涵蓋了一些特殊情況時,應該能夠向上看「正則表達式的語法」,而不是向試圖幫助的人投票。 –