[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109115: * lisp/textmodes/tex-mode.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109115: * lisp/textmodes/tex-mode.el (tex-font-lock-keywords-1): Highlight not only |
Date: |
Tue, 17 Jul 2012 04:11:31 -0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109115
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11953
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2012-07-17 04:11:31 -0400
message:
* lisp/textmodes/tex-mode.el (tex-font-lock-keywords-1): Highlight not only
$$..$$ but also $..$ using regexps.
Use tex-verbatim for \url and \path.
(tex-font-lock-keywords): Define as defconst like the others.
(tex-common-initialization): Don't use font-lock-syntax-table any more.
* test/indent/latex-mode.tex: New file.
added:
test/indent/latex-mode.tex
modified:
lisp/ChangeLog
lisp/textmodes/tex-mode.el
test/ChangeLog
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-07-17 04:17:23 +0000
+++ b/lisp/ChangeLog 2012-07-17 08:11:31 +0000
@@ -1,3 +1,11 @@
+2012-07-17 Stefan Monnier <address@hidden>
+
+ * textmodes/tex-mode.el (tex-font-lock-keywords-1): Highlight not only
+ $$..$$ but also $..$ using regexps (bug#11953).
+ Use tex-verbatim for \url and \path.
+ (tex-font-lock-keywords): Define as defconst like the others.
+ (tex-common-initialization): Don't use font-lock-syntax-table any more.
+
2012-07-16 René Kyllingstad <address@hidden> (tiny change)
* international/mule-cmds.el (ucs-insert): Make it an obsolete
@@ -14,8 +22,8 @@
Remove vars.
(python-nav-list-defun-positions, python-nav-read-defun)
(python-imenu-tree-assoc, python-imenu-make-element-tree)
- (python-imenu-make-tree, python-imenu-create-index): Remove
- functions.
+ (python-imenu-make-tree, python-imenu-create-index):
+ Remove functions.
(python-mode): Update to interact with imenu by setting
`imenu-extract-index-name-function' only.
@@ -56,8 +64,8 @@
(xterm-mouse-event): New arg specifying mouse protocol.
(turn-on-xterm-mouse-tracking-on-terminal)
(turn-off-xterm-mouse-tracking-on-terminal): Send DEC 1006
- sequence to toggle extended coordinates on newer XTerms. This
- appears to be harmless on terminals which do not support this.
+ sequence to toggle extended coordinates on newer XTerms.
+ This appears to be harmless on terminals which do not support this.
2012-07-14 Leo Liu <address@hidden>
@@ -81,8 +89,8 @@
2012-07-14 Chong Yidong <address@hidden>
- * bindings.el: Consolidate ctl-x-r-map bindings. Bind
- copy-rectangle-as-kill to C-x r w.
+ * bindings.el: Consolidate ctl-x-r-map bindings.
+ Bind copy-rectangle-as-kill to C-x r w.
* rect.el, register.el: Move bindings to bindings.el.
@@ -123,8 +131,8 @@
Remove toggle-read-only.
* bs.el (bs-toggle-readonly):
- * buff-menu.el (Buffer-menu-toggle-read-only): Remove
- with-no-warnings around toggle-read-only.
+ * buff-menu.el (Buffer-menu-toggle-read-only):
+ Remove with-no-warnings around toggle-read-only.
* ffap.el (ffap--toggle-read-only): Accept a list of buffers.
Remove with-no-warnings around toggle-read-only.
=== modified file 'lisp/textmodes/tex-mode.el'
--- a/lisp/textmodes/tex-mode.el 2012-07-11 23:13:41 +0000
+++ b/lisp/textmodes/tex-mode.el 2012-07-17 08:11:31 +0000
@@ -476,46 +476,51 @@
'("input" "include" "includeonly" "bibliography"
"epsfig" "psfig" "epsf" "nofiles" "usepackage"
"documentstyle" "documentclass" "verbatiminput"
- "includegraphics" "includegraphics*"
- "url" "nolinkurl")
+ "includegraphics" "includegraphics*")
t))
+ (verbish (regexp-opt '("url" "nolinkurl" "path") t))
;; Miscellany.
(slash "\\\\")
(opt " *\\(\\[[^]]*\\] *\\)*")
;; This would allow highlighting \newcommand\CMD but requires
;; adapting subgroup numbers below.
;; (arg
"\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)"))
- (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
- (list
- ;; display $$ math $$
- ;; We only mark the match between $$ and $$ because the $$ delimiters
- ;; themselves have already been marked (along with $..$) by syntactic
- ;; fontification. Also this is done at the very beginning so as to
- ;; interact with the other keywords in the same way as $...$ does.
- (list "\\$\\$\\([^$]+\\)\\$\\$" 1 'tex-math-face)
- ;; Heading args.
- (list (concat slash headings "\\*?" opt arg)
- ;; If ARG ends up matching too much (if the {} don't match, e.g.)
- ;; jit-lock will do funny things: when updating the buffer
- ;; the re-highlighting is only done locally so it will just
- ;; match the local line, but defer-contextually will
- ;; match more lines at a time, so ARG will end up matching
- ;; a lot more, which might suddenly include a comment
- ;; so you get things highlighted bold when you type them
- ;; but they get turned back to normal a little while later
- ;; because "there's already a face there".
- ;; Using `keep' works around this un-intuitive behavior as well
- ;; as improves the behavior in the very rare case where you do
- ;; have a comment in ARG.
- 3 'font-lock-function-name-face 'keep)
- (list (concat slash "\\(?:provide\\|\\(?:re\\)?new\\)command\\**
*\\(address@hidden)")
- 1 'font-lock-function-name-face 'keep)
- ;; Variable args.
- (list (concat slash variables " *" arg) 2 'font-lock-variable-name-face)
- ;; Include args.
- (list (concat slash includes opt arg) 3 'font-lock-builtin-face)
- ;; Definitions. I think.
- '("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)"
+ (inbraces-re (lambda (re)
+ (concat "\\(?:[^{}\\]\\|\\\\.\\|" re "\\)")))
+ (arg (concat "{\\(" (funcall inbraces-re "{[^}]*}") "+\\)")))
+ `( ;; Highlight $$math$$ and $math$.
+ ;; This is done at the very beginning so as to interact with the other
+ ;; keywords in the same way as comments and strings.
+ (,(concat "\\$\\$?\\(?:[^$\\{}]\\|\\\\.\\|{"
+ (funcall inbraces-re
+ (concat "{" (funcall inbraces-re "{[^}]*}") "*}"))
+ "*}\\)+\\$?\\$")
+ (0 tex-math-face))
+ ;; Heading args.
+ (,(concat slash headings "\\*?" opt arg)
+ ;; If ARG ends up matching too much (if the {} don't match, e.g.)
+ ;; jit-lock will do funny things: when updating the buffer
+ ;; the re-highlighting is only done locally so it will just
+ ;; match the local line, but defer-contextually will
+ ;; match more lines at a time, so ARG will end up matching
+ ;; a lot more, which might suddenly include a comment
+ ;; so you get things highlighted bold when you type them
+ ;; but they get turned back to normal a little while later
+ ;; because "there's already a face there".
+ ;; Using `keep' works around this un-intuitive behavior as well
+ ;; as improves the behavior in the very rare case where you do
+ ;; have a comment in ARG.
+ 3 font-lock-function-name-face keep)
+ (,(concat slash "\\(?:provide\\|\\(?:re\\)?new\\)command\\**
*\\(address@hidden)")
+ 1 font-lock-function-name-face keep)
+ ;; Variable args.
+ (,(concat slash variables " *" arg) 2 font-lock-variable-name-face)
+ ;; Include args.
+ (,(concat slash includes opt arg) 3 font-lock-builtin-face)
+ ;; Verbatim-like args.
+ (,(concat slash verbish opt arg) 3 'tex-verbatim)
+ ;; Definitions. I think.
+ ("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)"
1 font-lock-function-name-face))))
"Subdued expressions to highlight in TeX modes.")
@@ -629,7 +634,7 @@
(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
+(defconst tex-font-lock-keywords tex-font-lock-keywords-1
"Default expressions to highlight in TeX modes.")
(defvar tex-verbatim-environments
@@ -1219,7 +1224,7 @@
(set (make-local-variable 'font-lock-defaults)
'((tex-font-lock-keywords tex-font-lock-keywords-1
tex-font-lock-keywords-2 tex-font-lock-keywords-3)
- nil nil ((?$ . "\"")) nil
+ nil nil nil nil
;; Who ever uses that anyway ???
(font-lock-mark-block-function . mark-paragraph)
(font-lock-syntactic-face-function
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2012-07-11 23:13:41 +0000
+++ b/test/ChangeLog 2012-07-17 08:11:31 +0000
@@ -1,3 +1,7 @@
+2012-07-17 Stefan Monnier <address@hidden>
+
+ * indent/latex-mode.tex: New file.
+
2012-07-11 Stefan Monnier <address@hidden>
* eshell.el: Use cl-lib.
=== added file 'test/indent/latex-mode.tex'
--- a/test/indent/latex-mode.tex 1970-01-01 00:00:00 +0000
+++ b/test/indent/latex-mode.tex 2012-07-17 08:11:31 +0000
@@ -0,0 +1,11 @@
+\documentclass{article} % -*- eval: (bug-reference-mode 1) -*-
+
+\usepackage[utf8]{inputenc}
+
+\begin{document}
+
+To fix this, remove the \url{sn9c102.ko} from where it appears in
+\url{/lib/modules/$(uname -r)}, %bug#11953.
+and install the appropriate \url{gspca-modules} package.
+
+\end{document}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109115: * lisp/textmodes/tex-mode.el (tex-font-lock-keywords-1): Highlight not only,
Stefan Monnier <=