Commit c25d0edb authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(tex-verbatim-environments): Add safe-local-variable property.

(tex-font-lock-syntactic-keywords): Lookup tex-verbatim-environments
when starting font-lock rather than when loading tex-mode.el.
parent 1de49d4e
2007-07-16 Stefan Monnier <monnier@iro.umontreal.ca> 2007-07-16 Stefan Monnier <monnier@iro.umontreal.ca>
* textmodes/tex-mode.el (tex-verbatim-environments):
Add safe-local-variable property.
(tex-font-lock-syntactic-keywords): Lookup tex-verbatim-environments
when starting font-lock rather than when loading tex-mode.el.
* progmodes/sh-script.el (sh-font-lock-quoted-subshell): Skip over the * progmodes/sh-script.el (sh-font-lock-quoted-subshell): Skip over the
whole $( rather than just the $. Rename from sh-quoted-subshell. whole $( rather than just the $. Rename from sh-quoted-subshell.
(sh-font-lock-syntactic-keywords): Adjust call accordingly. (sh-font-lock-syntactic-keywords): Adjust call accordingly.
......
...@@ -637,26 +637,31 @@ An alternative value is \" . \", if you use a font with a narrow period." ...@@ -637,26 +637,31 @@ An alternative value is \" . \", if you use a font with a narrow period."
(defvar tex-verbatim-environments (defvar tex-verbatim-environments
'("verbatim" "verbatim*")) '("verbatim" "verbatim*"))
(put 'tex-verbatim-environments 'safe-local-variable
(lambda (x) (require 'cl) (every 'stringp x)))
(defvar tex-font-lock-syntactic-keywords (defvar tex-font-lock-syntactic-keywords
(let ((verbs (regexp-opt tex-verbatim-environments t))) '((eval . `(,(concat "^\\\\begin *{"
`((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|") (regexp-opt tex-verbatim-environments t)
;; Technically, we'd like to put the "|" property on the \n preceding "}.*\\(\n\\)") 2 "|"))
;; the \end, but this would have 2 disadvantages: ;; Technically, we'd like to put the "|" property on the \n preceding
;; 1 - it's wrong if the verbatim env is empty (the same \n is used to ;; the \end, but this would have 2 disadvantages:
;; start and end the fenced-string). ;; 1 - it's wrong if the verbatim env is empty (the same \n is used to
;; 2 - font-lock considers the preceding \n as being part of the ;; start and end the fenced-string).
;; preceding line, so things gets screwed every time the previous ;; 2 - font-lock considers the preceding \n as being part of the
;; line is re-font-locked on its own. ;; preceding line, so things gets screwed every time the previous
;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim ;; line is re-font-locked on its own.
;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef ;; There's a hack in tex-font-lock-keywords-1 to remove the verbatim
(,(concat "^\\(\\\\\\)end *{" verbs "}\\(.?\\)") (1 "|") (3 "<")) ;; face from the \ but C-M-f still jumps to the wrong spot :-( --Stef
;; ("^\\(\\\\\\)begin *{comment}" 1 "< b") (eval . `(,(concat "^\\(\\\\\\)end *{"
;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b") (regexp-opt tex-verbatim-environments t)
("\\\\verb\\**\\([^a-z@*]\\)" "}\\(.?\\)") (1 "|") (3 "<")))
;; Do it last, because it uses syntax-ppss which needs the ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
;; syntax-table properties of previous entries. ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
1 (tex-font-lock-verb (match-end 1)))))) ("\\\\verb\\**\\([^a-z@*]\\)"
;; Do it last, because it uses syntax-ppss which needs the
;; syntax-table properties of previous entries.
1 (tex-font-lock-verb (match-end 1)))))
(defun tex-font-lock-unfontify-region (beg end) (defun tex-font-lock-unfontify-region (beg end)
(font-lock-default-unfontify-region beg end) (font-lock-default-unfontify-region beg end)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment