]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/tex-mode.el
Convert consecutive FSF copyright years to ranges.
[gnu-emacs] / lisp / textmodes / tex-mode.el
index 70e4d1e3953b858e8bf2bddac1508579b3bd8641..8a9aa03bf69a3dcf3bba2f38f75ffcff7e50d51a 100644 (file)
@@ -1,7 +1,6 @@
 ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands -*- coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1986, 1989, 1992, 1994, 1995, 1996, 1997, 1998
-;;   1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2011
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -791,20 +790,23 @@ Not smaller than the value set by `tex-suscript-height-minimum'."
 (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)
@@ -864,6 +866,7 @@ START is the position of the \\ and DELIM is the delimiter char."
 
     ;; Redundant keybindings, for consistency with SGML mode.
     (define-key map "\C-c\C-t" 'latex-insert-block)
+    (define-key map "\C-c]" 'latex-close-block)
     (define-key map "\C-c/" 'latex-close-block)
 
     (define-key map "\C-c\C-e" 'latex-close-block)
@@ -2914,5 +2917,4 @@ There might be text before point."
 
 (provide 'tex-mode)
 
-;; arch-tag: c0a680b1-63aa-4547-84b9-4193c29c0080
 ;;; tex-mode.el ends here