500 |
1 font-lock-function-name-face)))) |
1 font-lock-function-name-face)))) |
501 |
"Subdued expressions to highlight in TeX modes.") |
"Subdued expressions to highlight in TeX modes.") |
502 |
|
|
503 |
|
(defun tex-font-lock-append-prop (prop) |
504 |
|
(unless (memq (get-text-property (match-end 1) 'face) |
505 |
|
'(font-lock-comment-face tex-verbatim-face)) |
506 |
|
prop)) |
507 |
|
|
508 |
(defconst tex-font-lock-keywords-2 |
(defconst tex-font-lock-keywords-2 |
509 |
(append tex-font-lock-keywords-1 |
(append tex-font-lock-keywords-1 |
510 |
(eval-when-compile |
(eval-when-compile |
558 |
;; |
;; |
559 |
;; Font environments. It seems a bit dubious to use `bold' etc. faces |
;; Font environments. It seems a bit dubious to use `bold' etc. faces |
560 |
;; since we might not be able to display those fonts. |
;; since we might not be able to display those fonts. |
561 |
(list (concat slash bold " *" arg) 2 '(quote bold) 'append) |
(list (concat slash bold " *" arg) 2 |
562 |
(list (concat slash italic " *" arg) 2 '(quote italic) 'append) |
'(tex-font-lock-append-prop 'bold) 'append) |
563 |
|
(list (concat slash italic " *" arg) 2 |
564 |
|
'(tex-font-lock-append-prop 'italic) 'append) |
565 |
;; (list (concat slash type arg) 2 '(quote bold-italic) 'append) |
;; (list (concat slash type arg) 2 '(quote bold-italic) 'append) |
566 |
;; |
;; |
567 |
;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. |
;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. |
568 |
(list (concat "\\\\\\(em\\|it\\|sl\\)\\>" args) |
(list (concat "\\\\\\(em\\|it\\|sl\\)\\>" args) |
569 |
2 '(quote italic) 'append) |
2 '(tex-font-lock-append-prop 'italic) 'append) |
570 |
;; This is separate from the previous one because of cases like |
;; This is separate from the previous one because of cases like |
571 |
;; {\em foo {\bf bar} bla} where both match. |
;; {\em foo {\bf bar} bla} where both match. |
572 |
(list (concat "\\\\bf\\>" args) 1 '(quote bold) 'append))))) |
(list (concat "\\\\\\(bf\\)\\>" args) |
573 |
|
2 '(tex-font-lock-append-prop 'bold) 'append))))) |
574 |
"Gaudy expressions to highlight in TeX modes.") |
"Gaudy expressions to highlight in TeX modes.") |
575 |
|
|
576 |
(defun tex-font-lock-suscript (pos) |
(defun tex-font-lock-suscript (pos) |
612 |
(defvar tex-font-lock-syntactic-keywords |
(defvar tex-font-lock-syntactic-keywords |
613 |
(let ((verbs (regexp-opt tex-verbatim-environments t))) |
(let ((verbs (regexp-opt tex-verbatim-environments t))) |
614 |
`((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|") |
`((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|") |
615 |
(,(concat "^\\\\end *{" verbs "}\\(.?\\)") 2 |
;; Technically, we'd like to put the "|" property on the \n preceding |
616 |
(unless (<= (match-beginning 0) (point-min)) |
;; the \end, but this would have 2 disadvantages: |
617 |
(put-text-property (1- (match-beginning 0)) (match-beginning 0) |
;; 1 - it's wrong if the verbatim env is empty (the same \n is used to |
618 |
'syntax-table (string-to-syntax "|")) |
;; start and end the fenced-string). |
619 |
"<")) |
;; 2 - font-lock considers the preceding \n as being part of the |
620 |
|
;; preceding line, so things gets screwed every time the previous |
621 |
|
;; line is re-font-locked on its own. |
622 |
|
(,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<")) |
623 |
;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") |
;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") |
624 |
;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") |
;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") |
625 |
("\\\\verb\\**\\([^a-z@*]\\)" 1 "\"")))) |
("\\\\verb\\**\\([^a-z@*]\\)" 1 "\"")))) |