Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
587043f8
Commit
587043f8
authored
Apr 17, 2006
by
Stefan Monnier
Browse files
(tex-font-lock-match-suscript): New function.
(tex-font-lock-keywords-3): Use it.
parent
461e9977
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
12 deletions
+21
-12
lisp/ChangeLog
lisp/ChangeLog
+5
-0
lisp/textmodes/tex-mode.el
lisp/textmodes/tex-mode.el
+16
-12
No files found.
lisp/ChangeLog
View file @
587043f8
2006-04-17 Ralf Angeli <angeli@iwi.uni-sb.de>
* textmodes/tex-mode.el (tex-font-lock-match-suscript): New function.
(tex-font-lock-keywords-3): Use it.
2006-04-16 Stefan Monnier <monnier@iro.umontreal.ca>
* newcomment.el (comment-add): New function.
...
...
lisp/textmodes/tex-mode.el
View file @
587043f8
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment