branch: externals/auctex commit 51d8d3da4ab450beb2812892f38159be38c013c1 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Recognize optional argument in verb macros with delimiters/braces * font-latex.el (font-latex-built-in-keyword-classes): Add \verb to textual keyword class. (font-latex-set-syntactic-keywords): Extend regexp to ignore an optional argument for verbatim macros with delimiters and/or braces. --- font-latex.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/font-latex.el b/font-latex.el index a56d3ce..0f2c893 100644 --- a/font-latex.el +++ b/font-latex.el @@ -387,7 +387,7 @@ variable `font-latex-fontify-sectioning'." ',num) ("textual" (("item" "[") ("title" "{") ("author" "{") ("date" "{") ("thanks" "{") ("address" "{") ("caption" "[{") - ("textsuperscript" "{") ("textsubscript" "{")) + ("textsuperscript" "{") ("textsubscript" "{") ("verb" "*")) font-lock-type-face 2 command) ("bold-command" (("textbf" "{") ("textsc" "{") ("textup" "{") ("boldsymbol" "{") @@ -1005,6 +1005,10 @@ have changed." (unless (= (length verb-macros-with-delims) 0) (add-to-list 'font-latex-syntactic-keywords `(,(concat "\\\\\\(?:" verb-macros-with-delims "\\)" + ;; Some macros take an optional + ;; argument. This is the same line as + ;; above for environments. + "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?" ;; An opening curly brace as delimiter ;; is valid, but allowing it might screw ;; up fontification of stuff like @@ -1019,6 +1023,10 @@ have changed." (unless (= (length verb-macros-with-braces) 0) (add-to-list 'font-latex-syntactic-keywords `(,(concat "\\\\\\(?:" verb-macros-with-braces "\\)" + ;; Some macros take an optional + ;; argument. This is the same line as + ;; above for environments. + "\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?" "\\({\\).*?[^\\]\\(?:\\\\\\\\\\)*\\(}\\)") (1 "|") (2 "|"))))) (when font-latex-syntactic-keywords-extra