summaryrefslogtreecommitdiff
path: root/lisp/textmodes/tex-mode.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
commit447b0165acd09060977e05c843f81c0bee4aa4df (patch)
tree70cf2d254760a2cf68a10b67f8a3570c05fff9a5 /lisp/textmodes/tex-mode.el
parent4c57cca724993ab1334cc5c0b35c22b06daee0c3 (diff)
parent0fea1d10293b4c6d35c1e55b68cd26e91445213c (diff)
downloademacs-447b0165acd09060977e05c843f81c0bee4aa4df.tar.gz
emacs-447b0165acd09060977e05c843f81c0bee4aa4df.tar.bz2
emacs-447b0165acd09060977e05c843f81c0bee4aa4df.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-216 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-217 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-218 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-219 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-220 Improve tq.el. * emacs@sv.gnu.org/emacs--devo--0--patch-221 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-222 Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * emacs@sv.gnu.org/emacs--devo--0--patch-223 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-224 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-225 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-226 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-227 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-228 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-229 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-230 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-231 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-232 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-233 Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-84 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-85 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-86 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-550
Diffstat (limited to 'lisp/textmodes/tex-mode.el')
-rw-r--r--lisp/textmodes/tex-mode.el28
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 97153e31a25..8ca7c3026e8 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -594,20 +594,24 @@ An alternative value is \" . \", if you use a font with a narrow period."
'(face subscript display (raise -0.3))
'(face superscript display (raise +0.3)))))
+(defun tex-font-lock-match-suscript (limit)
+ "Match subscript and superscript patterns up to LIMIT."
+ (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\
+\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|{[^\\{]*}\\|\\({\\)\\)" limit t)
+ (when (match-end 3)
+ (let ((beg (match-beginning 3))
+ (end (save-restriction
+ (narrow-to-region (point-min) limit)
+ (condition-case nil (scan-lists (point) 1 1) (error nil)))))
+ (store-match-data (if end
+ (list (match-beginning 0) end beg end)
+ (list beg beg beg beg)))))
+ t))
+
(defconst tex-font-lock-keywords-3
(append tex-font-lock-keywords-2
- (eval-when-compile
- (let ((general "\\([a-zA-Z@]+\\|[^ \t\n]\\)")
- (slash "\\\\")
- ;; This is not the same regexp as before: it has a `+' removed.
- ;; The + makes the matching faster in the above cases (where we can
- ;; exit as soon as the match fails) but would make this matching
- ;; degenerate to nasty complexity (because we try to match the
- ;; closing brace, which forces trying all matching combinations).
- (arg "{\\(?:[^{}\\]\\|\\\\.\\|{[^}]*}\\)*"))
- `((,(concat "[_^] *\\([^\n\\{}#]\\|" slash general "\\|#[0-9]\\|" arg "}\\)")
- (1 (tex-font-lock-suscript (match-beginning 0))
- append))))))
+ '((tex-font-lock-match-suscript
+ (1 (tex-font-lock-suscript (match-beginning 0)) append))))
"Experimental expressions to highlight in TeX modes.")
(defvar tex-font-lock-keywords tex-font-lock-keywords-1