comparison lisp/textmodes/tex-mode.el @ 90984:a1be62cbd32a

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 814-815) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-232
author Miles Bader <miles@gnu.org>
date Wed, 18 Jul 2007 22:15:15 +0000
parents a66921565bcb 82e8a862c00b
children 492971a3f31f
comparison
equal deleted inserted replaced
90983:8cdd8b5fa891 90984:a1be62cbd32a
635 (defvar tex-font-lock-keywords tex-font-lock-keywords-1 635 (defvar tex-font-lock-keywords tex-font-lock-keywords-1
636 "Default expressions to highlight in TeX modes.") 636 "Default expressions to highlight in TeX modes.")
637 637
638 (defvar tex-verbatim-environments 638 (defvar tex-verbatim-environments
639 '("verbatim" "verbatim*")) 639 '("verbatim" "verbatim*"))
640 (put 'tex-verbatim-environments 'safe-local-variable
641 (lambda (x) (require 'cl) (every 'stringp x)))
640 642
641 (defvar tex-font-lock-syntactic-keywords 643 (defvar tex-font-lock-syntactic-keywords
642 (let ((verbs (regexp-opt tex-verbatim-environments t))) 644 '((eval . `(,(concat "^\\\\begin *{"
643 `((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|") 645 (regexp-opt tex-verbatim-environments t)
644 ;; Technically, we'd like to put the "|" property on the \n preceding 646 "}.*\\(\n\\)") 2 "|"))
645 ;; the \end, but this would have 2 disadvantages: 647 ;; Technically, we'd like to put the "|" property on the \n preceding
646 ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to 648 ;; the \end, but this would have 2 disadvantages:
647 ;; start and end the fenced-string). 649 ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
648 ;; 2 - font-lock considers the preceding \n as being part of the 650 ;; start and end the fenced-string).
649 ;; preceding line, so things gets screwed every time the previous 651 ;; 2 - font-lock considers the preceding \n as being part of the
650 ;; line is re-font-locked on its own. 652 ;; preceding line, so things gets screwed every time the previous
651 ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim 653 ;; line is re-font-locked on its own.
652 ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef 654 ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
653 (,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<")) 655 ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef
654 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") 656 (eval . `(,(concat "^\\(\\\\\\)end *{"
655 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") 657 (regexp-opt tex-verbatim-environments t)
656 ("\\\\verb\\**\\([^a-z@*]\\)" 658 "}\\(.?\\)") (1 "|") (3 "<")))
657 ;; Do it last, because it uses syntax-ppss which needs the 659 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
658 ;; syntax-table properties of previous entries. 660 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
659 1 (tex-font-lock-verb (match-end 1)))))) 661 ("\\\\verb\\**\\([^a-z@*]\\)"
662 ;; Do it last, because it uses syntax-ppss which needs the
663 ;; syntax-table properties of previous entries.
664 1 (tex-font-lock-verb (match-end 1)))))
660 665
661 (defun tex-font-lock-unfontify-region (beg end) 666 (defun tex-font-lock-unfontify-region (beg end)
662 (font-lock-default-unfontify-region beg end) 667 (font-lock-default-unfontify-region beg end)
663 (while (< beg end) 668 (while (< beg end)
664 (let ((next (next-single-property-change beg 'display nil end)) 669 (let ((next (next-single-property-change beg 'display nil end))