emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102887: * lisp/textmodes/tex-mode.el


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102887: * lisp/textmodes/tex-mode.el (tex-font-lock-verb): Make sure \verb
Date: Mon, 17 Jan 2011 23:07:36 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102887
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2011-01-17 23:07:36 -0500
message:
  * lisp/textmodes/tex-mode.el (tex-font-lock-verb): Make sure \verb
  highlighting doesn't spill over subsequent lines.
modified:
  lisp/ChangeLog
  lisp/textmodes/tex-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-18 02:49:59 +0000
+++ b/lisp/ChangeLog    2011-01-18 04:07:36 +0000
@@ -1,10 +1,11 @@
 2011-01-18  Stefan Monnier  <address@hidden>
 
+       * textmodes/tex-mode.el (tex-font-lock-verb): Make sure \verb
+       highlighting doesn't spill over subsequent lines.
+
        * emacs-lisp/easy-mmode.el (define-minor-mode): Don't re-evaluate the
        keymap expression.  Improve docstring.
 
-2011-01-18  Stefan Monnier  <address@hidden>
-
        * electric.el (electric-indent-post-self-insert-function):
        Don't auto-indent for indent-to-left-margin, it's too often
        counter-productive.

=== modified file 'lisp/textmodes/tex-mode.el'
--- a/lisp/textmodes/tex-mode.el        2011-01-15 23:16:57 +0000
+++ b/lisp/textmodes/tex-mode.el        2011-01-18 04:07:36 +0000
@@ -791,20 +791,23 @@
 (defun tex-font-lock-verb (start delim)
   "Place syntax table properties on the \verb construct.
 START is the position of the \\ and DELIM is the delimiter char."
-    ;; Do nothing if the \verb construct is itself inside a comment or
-    ;; verbatim env.
+  ;; Do nothing if the \verb construct is itself inside a comment or
+  ;; verbatim env.
   (unless (nth 8 (save-excursion (syntax-ppss start)))
-      ;; Let's find the end and mark it.
-    ;; This may span more than a single line, but we don't bother
-    ;; placing a syntax-multiline property since such multiline verbs aren't
-    ;; valid anyway.
-    (skip-chars-forward (string ?^ delim))
-        (unless (eobp)
-      (when (eq (char-syntax (preceding-char)) ?/)
-        (put-text-property (1- (point)) (point)
-                           'syntax-table (string-to-syntax ".")))
-      (put-text-property (point) (1+ (point))
-                         'syntax-table (string-to-syntax "\"")))))
+    ;; Let's find the end and mark it.
+    (let ((afterdelim (point)))
+      (skip-chars-forward (string ?^ delim) (line-end-position))
+      (if (eolp)
+          ;; "LaTeX Error: \verb ended by end of line."
+          ;; Remove the syntax-table property we've just put on the
+          ;; start-delimiter, so it doesn't spill over subsequent lines.
+          (put-text-property (1- afterdelim) afterdelim
+                             'syntax-table nil)
+        (when (eq (char-syntax (preceding-char)) ?/)
+          (put-text-property (1- (point)) (point)
+                             'syntax-table (string-to-syntax ".")))
+        (put-text-property (point) (1+ (point))
+                           'syntax-table (string-to-syntax "\""))))))
 
 ;; Use string syntax but math face for $...$.
 (defun tex-font-lock-syntactic-face-function (state)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]