comparison lisp/textmodes/tex-mode.el @ 57698:5e84f3fe94f0

(tex-font-lock-keywords-1): Fix up the spurious verbatim face on the \ of \end{verbatim}.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 25 Oct 2004 20:35:24 +0000
parents 7e77ec815f3a
children 35f8fcf3abca 0fe073a08cef
comparison
equal deleted inserted replaced
57697:64443697a546 57698:5e84f3fe94f0
466 ;; This would allow highlighting \newcommand\CMD but requires 466 ;; This would allow highlighting \newcommand\CMD but requires
467 ;; adapting subgroup numbers below. 467 ;; adapting subgroup numbers below.
468 ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)")) 468 ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)"))
469 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) 469 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
470 (list 470 (list
471 ;; font-lock-syntactic-keywords causes the \ of \end{verbatim} to be
472 ;; highlighted as tex-verbatim-face. Let's undo that.
473 ;; This is ugly and brittle :-( --Stef
474 '("^\\(\\\\\\)end" (1 (get-text-property (match-end 1) 'face) t))
471 ;; display $$ math $$ 475 ;; display $$ math $$
472 ;; We only mark the match between $$ and $$ because the $$ delimiters 476 ;; We only mark the match between $$ and $$ because the $$ delimiters
473 ;; themselves have already been marked (along with $..$) by syntactic 477 ;; themselves have already been marked (along with $..$) by syntactic
474 ;; fontification. Also this is done at the very beginning so as to 478 ;; fontification. Also this is done at the very beginning so as to
475 ;; interact with the other keywords in the same way as $...$ does. 479 ;; interact with the other keywords in the same way as $...$ does.
617 ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to 621 ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
618 ;; start and end the fenced-string). 622 ;; start and end the fenced-string).
619 ;; 2 - font-lock considers the preceding \n as being part of the 623 ;; 2 - font-lock considers the preceding \n as being part of the
620 ;; preceding line, so things gets screwed every time the previous 624 ;; preceding line, so things gets screwed every time the previous
621 ;; line is re-font-locked on its own. 625 ;; line is re-font-locked on its own.
626 ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
627 ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef
622 (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<")) 628 (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<"))
623 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") 629 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
624 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") 630 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
625 ("\\\\verb\\**\\([^a-z@*]\\)" 1 "\"")))) 631 ("\\\\verb\\**\\([^a-z@*]\\)" 1 "\""))))
626 632