aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2002-11-08 16:56:57 +0000
committerStefan Monnier2002-11-08 16:56:57 +0000
commit7afecb99cb88f237832bbd9fa82a8cb2f0b78ec3 (patch)
tree823a9357ef56ab69fc6c5c87a36e5c9596023975
parent6bae0ccfb12006d172b7f9670110edff3246217a (diff)
downloademacs-7afecb99cb88f237832bbd9fa82a8cb2f0b78ec3.tar.gz
emacs-7afecb99cb88f237832bbd9fa82a8cb2f0b78ec3.zip
(latex-standard-block-names): Rename from standard-latex-block-names.
(tex-font-lock-keywords-1): Add providecommand, renewenvironment, and renewtheorem. Highlight \it and \bf separately since they may overlap. (tex-font-lock-suscript, tex-font-lock-unfontify-region): New funs. (tex-font-lock-keywords-3, tex-verbatim-environments) (tex-font-lock-syntactic-keywords): New vars. (superscript, subscript, tex-verbatim-face): New faces. (tex-font-lock-syntactic-face-function): Handle \verb construct. (tex-common-initialization): Update font-lock-defaults setting. (tex-insert-braces): Make it into a skeleton. (latex-fill-nobreak-predicate): Don't break after \. (latex-insert-block): Rename from tex-latex-block. (latex-down-list): Use tex-mode-syntax-table when skipping parens rather than the indentation syntax-table. (latex-close-block): Rename from tex-close-latex-block. (latex-split-block): New fun. (latex-indent): Don't indent inside a verbatim block. (latex-find-indent): Stick \begin{verbatim} to the margin.
-rw-r--r--lisp/textmodes/tex-mode.el244
1 files changed, 177 insertions, 67 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index f3f7e9dc685..e5635777985 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -141,7 +141,7 @@ If nil, no commands are used. See the documentation of `tex-command'."
141 :group 'tex-run 141 :group 'tex-run
142 :version "21.4") 142 :version "21.4")
143 143
144(defvar standard-latex-block-names 144(defvar latex-standard-block-names
145 '("abstract" "array" "center" "description" 145 '("abstract" "array" "center" "description"
146 "displaymath" "document" "enumerate" "eqnarray" 146 "displaymath" "document" "enumerate" "eqnarray"
147 "eqnarray*" "equation" "figure" "figure*" 147 "eqnarray*" "equation" "figure" "figure*"
@@ -156,7 +156,7 @@ If nil, no commands are used. See the documentation of `tex-command'."
156;;;###autoload 156;;;###autoload
157(defcustom latex-block-names nil 157(defcustom latex-block-names nil
158 "*User defined LaTeX block names. 158 "*User defined LaTeX block names.
159Combined with `standard-latex-block-names' for minibuffer completion." 159Combined with `latex-standard-block-names' for minibuffer completion."
160 :type '(repeat string) 160 :type '(repeat string)
161 :group 'tex-run) 161 :group 'tex-run)
162 162
@@ -437,8 +437,9 @@ An alternative value is \" . \", if you use a font with a narrow period."
437 '("title" "begin" "end" "chapter" "part" 437 '("title" "begin" "end" "chapter" "part"
438 "section" "subsection" "subsubsection" 438 "section" "subsection" "subsubsection"
439 "paragraph" "subparagraph" "subsubparagraph" 439 "paragraph" "subparagraph" "subsubparagraph"
440 "newcommand" "renewcommand" "newenvironment" 440 "newcommand" "renewcommand" "providecommand"
441 "newtheorem") 441 "newenvironment" "renewenvironment"
442 "newtheorem" "renewtheorem")
442 t)) 443 t))
443 (variables (regexp-opt 444 (variables (regexp-opt
444 '("newcounter" "newcounter*" "setcounter" "addtocounter" 445 '("newcounter" "newcounter*" "setcounter" "addtocounter"
@@ -479,8 +480,8 @@ An alternative value is \" . \", if you use a font with a narrow period."
479 ;; as improves the behavior in the very rare case where you do 480 ;; as improves the behavior in the very rare case where you do
480 ;; have a comment in ARG. 481 ;; have a comment in ARG.
481 3 'font-lock-function-name-face 'keep) 482 3 'font-lock-function-name-face 'keep)
482 (list (concat slash "\\(re\\)?newcommand\\** *\\(\\\\[A-Za-z@]+\\)") 483 (list (concat slash "\\(?:provide\\|\\(?:re\\)?new\\)command\\** *\\(\\\\[A-Za-z@]+\\)")
483 2 'font-lock-function-name-face 'keep) 484 1 'font-lock-function-name-face 'keep)
484 ;; Variable args. 485 ;; Variable args.
485 (list (concat slash variables " *" arg) 2 'font-lock-variable-name-face) 486 (list (concat slash variables " *" arg) 2 'font-lock-variable-name-face)
486 ;; Include args. 487 ;; Include args.
@@ -521,6 +522,7 @@ An alternative value is \" . \", if you use a font with a narrow period."
521 ;; Miscellany. 522 ;; Miscellany.
522 (slash "\\\\") 523 (slash "\\\\")
523 (opt " *\\(\\[[^]]*\\] *\\)*") 524 (opt " *\\(\\[[^]]*\\] *\\)*")
525 (args "\\(\\(?:[^{}&\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")
524 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)")) 526 (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
525 (list 527 (list
526 ;; 528 ;;
@@ -546,23 +548,105 @@ An alternative value is \" . \", if you use a font with a narrow period."
546 ;; (list (concat slash type arg) 2 '(quote bold-italic) 'append) 548 ;; (list (concat slash type arg) 2 '(quote bold-italic) 'append)
547 ;; 549 ;;
548 ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables. 550 ;; Old-style bf/em/it/sl. Stop at `\\' and un-escaped `&', for tables.
549 (list (concat "\\\\\\(\\(bf\\)\\|em\\|it\\|sl\\)\\>" 551 (list (concat "\\\\\\(em\\|it\\|sl\\)\\>" args)
550 "\\(\\([^}&\\]\\|\\\\[^\\]\\)+\\)") 552 2 '(quote italic) 'append)
551 3 '(if (match-beginning 2) 'bold 'italic) 'append))))) 553 ;; This is separate from the previous one because of cases like
554 ;; {\em foo {\bf bar} bla} where both match.
555 (list (concat "\\\\bf\\>" args) 1 '(quote bold) 'append)))))
552 "Gaudy expressions to highlight in TeX modes.") 556 "Gaudy expressions to highlight in TeX modes.")
553 557
558(defun tex-font-lock-suscript (pos)
559 (unless (or (memq (get-text-property pos 'face)
560 '(font-lock-constant-face font-lock-builtin-face
561 font-lock-comment-face tex-verbatim-face))
562 ;; Check for backslash quoting
563 (let ((odd nil)
564 (pos pos))
565 (while (eq (char-before pos) ?\\)
566 (setq pos (1- pos) odd (not odd)))
567 odd))
568 (if (eq (char-after pos) ?_)
569 '(face subscript display (raise -0.3))
570 '(face superscript display (raise +0.3)))))
571
572(defconst tex-font-lock-keywords-3
573 (append tex-font-lock-keywords-2
574 (eval-when-compile
575 (let ((general "\\([a-zA-Z@]+\\|[^ \t\n]\\)")
576 (slash "\\\\")
577 ;; This is not the same regexp as before: it has a `+' removed.
578 ;; The + makes the matching faster in the above cases (where we can
579 ;; exit as soon as the match fails) but would make this matching
580 ;; degenerate to nasty complexity (because we try to match the
581 ;; closing brace, which forces trying all matching combinations).
582 (arg "{\\(?:[^{}\\]\\|\\\\.\\|{[^}]*}\\)*"))
583 `((,(concat "[_^] *\\([^\n\\{}]\\|" slash general "\\|" arg "}\\)")
584 (1 (tex-font-lock-suscript (match-beginning 0))
585 append))))))
586 "Experimental expressions to highlight in TeX modes.")
587
554(defvar tex-font-lock-keywords tex-font-lock-keywords-1 588(defvar tex-font-lock-keywords tex-font-lock-keywords-1
555 "Default expressions to highlight in TeX modes.") 589 "Default expressions to highlight in TeX modes.")
556 590
591(defvar tex-verbatim-environments
592 '("verbatim" "verbatim*"))
593
594(defvar tex-font-lock-syntactic-keywords
595 (let ((verbs (regexp-opt tex-verbatim-environments t)))
596 `((,(concat "^\\\\begin *{" verbs "}.*\\(\n\\)") 2 "|")
597 (,(concat "^\\\\end *{" verbs "}\\(.?\\)") 2
598 (unless (<= (match-beginning 0) (point-min))
599 (put-text-property (1- (match-beginning 0)) (match-beginning 0)
600 'syntax-table (string-to-syntax "|"))
601 "<"))
602 ;; ("^\\(\\\\\\)begin *{comment}" 1 "< b")
603 ;; ("^\\\\end *{comment}.*\\(\n\\)" 1 "> b")
604 ("\\\\verb\\**\\([^a-z@*]\\)" 1 "\""))))
605
606(defun tex-font-lock-unfontify-region (beg end)
607 (font-lock-default-unfontify-region beg end)
608 (while (< beg end)
609 (let ((next (next-single-property-change beg 'display nil end))
610 (prop (get-text-property beg 'display)))
611 (if (and (eq (car-safe prop) 'raise)
612 (member (car-safe (cdr prop)) '(-0.3 +0.3))
613 (null (cddr prop)))
614 (put-text-property beg next 'display nil))
615 (setq beg next))))
616
617(defface superscript
618 '((t :height 0.8)) ;; :raise 0.3
619 "Face used for superscripts.")
620(defface subscript
621 '((t :height 0.8)) ;; :raise -0.3
622 "Face used for subscripts.")
557 623
558(defface tex-math-face 624(defface tex-math-face
559 '((t :inherit font-lock-string-face)) 625 '((t :inherit font-lock-string-face))
560 "Face used to highlight TeX math expressions.") 626 "Face used to highlight TeX math expressions.")
561(defvar tex-math-face 'tex-math-face) 627(defvar tex-math-face 'tex-math-face)
628(defface tex-verbatim-face
629 ;; '((t :inherit font-lock-string-face))
630 '((t :family "courier"))
631 "Face used to highlight TeX verbatim environments.")
632(defvar tex-verbatim-face 'tex-verbatim-face)
562 633
563;; Use string syntax but math face for $...$. 634;; Use string syntax but math face for $...$.
564(defun tex-font-lock-syntactic-face-function (state) 635(defun tex-font-lock-syntactic-face-function (state)
565 (if (nth 3 state) tex-math-face font-lock-comment-face)) 636 (let ((char (nth 3 state)))
637 (cond
638 ((not char) font-lock-comment-face)
639 ((eq char ?$) tex-math-face)
640 (t
641 (when (char-valid-p char)
642 ;; This is a \verb?...? construct. Let's find the end and mark it.
643 (save-excursion
644 (skip-chars-forward (string ?^ char)) ;; Use `end' ?
645 (when (eq (char-syntax (preceding-char)) ?/)
646 (put-text-property (1- (point)) (point) 'syntax-table '(1)))
647 (unless (eobp)
648 (put-text-property (point) (1+ (point)) 'syntax-table '(7)))))
649 tex-verbatim-face))))
566 650
567 651
568(defun tex-define-common-keys (keymap) 652(defun tex-define-common-keys (keymap)
@@ -607,8 +691,8 @@ An alternative value is \" . \", if you use a font with a narrow period."
607 (define-key map "\C-c\C-b" 'tex-buffer) 691 (define-key map "\C-c\C-b" 'tex-buffer)
608 (define-key map "\C-c\C-f" 'tex-file) 692 (define-key map "\C-c\C-f" 'tex-file)
609 (define-key map "\C-c\C-i" 'tex-bibtex-file) 693 (define-key map "\C-c\C-i" 'tex-bibtex-file)
610 (define-key map "\C-c\C-o" 'tex-latex-block) 694 (define-key map "\C-c\C-o" 'latex-insert-block)
611 (define-key map "\C-c\C-e" 'tex-close-latex-block) 695 (define-key map "\C-c\C-e" 'latex-close-block)
612 (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block) 696 (define-key map "\C-c\C-u" 'tex-goto-last-unclosed-latex-block)
613 (define-key map "\C-c\C-m" 'tex-feed-input) 697 (define-key map "\C-c\C-m" 'tex-feed-input)
614 (define-key map [(control return)] 'tex-feed-input) 698 (define-key map [(control return)] 'tex-feed-input)
@@ -904,15 +988,21 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
904 (set (make-local-variable 'facemenu-end-add-face) "}") 988 (set (make-local-variable 'facemenu-end-add-face) "}")
905 (set (make-local-variable 'facemenu-remove-face-function) t) 989 (set (make-local-variable 'facemenu-remove-face-function) t)
906 (set (make-local-variable 'font-lock-defaults) 990 (set (make-local-variable 'font-lock-defaults)
907 '((tex-font-lock-keywords 991 '((tex-font-lock-keywords tex-font-lock-keywords-1
908 tex-font-lock-keywords-1 tex-font-lock-keywords-2) 992 tex-font-lock-keywords-2 tex-font-lock-keywords-3)
909 nil nil ((?$ . "\"")) nil 993 nil nil ((?$ . "\"")) nil
910 ;; Who ever uses that anyway ??? 994 ;; Who ever uses that anyway ???
911 (font-lock-mark-block-function . mark-paragraph) 995 (font-lock-mark-block-function . mark-paragraph)
912 (font-lock-syntactic-face-function 996 (font-lock-syntactic-face-function
913 . tex-font-lock-syntactic-face-function))) 997 . tex-font-lock-syntactic-face-function)
998 (font-lock-unfontify-region-function
999 . tex-font-lock-unfontify-region)
1000 (font-lock-syntactic-keywords
1001 . tex-font-lock-syntactic-keywords)
1002 (parse-sexp-lookup-properties . t)))
914 ;; TABs in verbatim environments don't do what you think. 1003 ;; TABs in verbatim environments don't do what you think.
915 (set (make-local-variable 'indent-tabs-mode) nil) 1004 (set (make-local-variable 'indent-tabs-mode) nil)
1005 ;; Other vars that should be buffer-local.
916 (make-local-variable 'tex-command) 1006 (make-local-variable 'tex-command)
917 (make-local-variable 'tex-start-of-header) 1007 (make-local-variable 'tex-start-of-header)
918 (make-local-variable 'tex-end-of-header) 1008 (make-local-variable 'tex-end-of-header)
@@ -1081,39 +1171,41 @@ A prefix arg inhibits the checking."
1081 (message "Paragraph being closed appears to contain a mismatch")) 1171 (message "Paragraph being closed appears to contain a mismatch"))
1082 (insert "\n\n")) 1172 (insert "\n\n"))
1083 1173
1084(defun tex-insert-braces () 1174(define-skeleton tex-insert-braces
1085 "Make a pair of braces and be poised to type inside of them." 1175 "Make a pair of braces and be poised to type inside of them."
1086 (interactive "*") 1176 nil
1087 (insert ?\{) 1177 ?\{ _ ?})
1088 (save-excursion
1089 (insert ?})))
1090 1178
1091;; This function is used as the value of fill-nobreak-predicate 1179;; This function is used as the value of fill-nobreak-predicate
1092;; in LaTeX mode. Its job is to prevent line-breaking inside 1180;; in LaTeX mode. Its job is to prevent line-breaking inside
1093;; of a \verb construct. 1181;; of a \verb construct.
1094(defun latex-fill-nobreak-predicate () 1182(defun latex-fill-nobreak-predicate ()
1095 (let ((opoint (point)) 1183 (save-excursion
1096 inside) 1184 (skip-chars-backward " ")
1097 (save-excursion 1185 ;; Don't break after \ since `\ ' has special meaning.
1098 (beginning-of-line) 1186 (or (and (not (bobp)) (memq (char-syntax (char-before)) '(?\\ ?/)))
1099 (while (re-search-forward "\\\\verb\\(.\\)" opoint t) 1187 (let ((opoint (point))
1100 (unless (re-search-forward (regexp-quote (match-string 1)) opoint t) 1188 inside)
1101 (setq inside t)))) 1189 (beginning-of-line)
1102 inside)) 1190 (while (re-search-forward "\\\\verb\\(.\\)" opoint t)
1191 (unless (re-search-forward (regexp-quote (match-string 1)) opoint t)
1192 (setq inside t)))
1193 inside))))
1103 1194
1104(defvar latex-block-default "enumerate") 1195(defvar latex-block-default "enumerate")
1105 1196
1106;; Like tex-insert-braces, but for LaTeX. 1197;; Like tex-insert-braces, but for LaTeX.
1107(define-skeleton tex-latex-block 1198(defalias 'tex-latex-block 'latex-insert-block)
1199(define-skeleton latex-insert-block
1108 "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point. 1200 "Create a matching pair of lines \\begin[OPT]{NAME} and \\end{NAME} at point.
1109Puts point on a blank line between them." 1201Puts point on a blank line between them."
1110 (let ((choice (completing-read (format "LaTeX block name [%s]: " 1202 (let ((choice (completing-read (format "LaTeX block name [%s]: "
1111 latex-block-default) 1203 latex-block-default)
1112 (append latex-block-names 1204 (append latex-block-names
1113 standard-latex-block-names) 1205 latex-standard-block-names)
1114 nil nil nil nil latex-block-default))) 1206 nil nil nil nil latex-block-default)))
1115 (setq latex-block-default choice) 1207 (setq latex-block-default choice)
1116 (unless (or (member choice standard-latex-block-names) 1208 (unless (or (member choice latex-standard-block-names)
1117 (member choice latex-block-names)) 1209 (member choice latex-block-names))
1118 ;; Remember new block names for later completion. 1210 ;; Remember new block names for later completion.
1119 (push choice latex-block-names)) 1211 (push choice latex-block-names))
@@ -1229,23 +1321,32 @@ Mark is left at original location."
1229 (down-list 1) 1321 (down-list 1)
1230 (forward-sexp 1) 1322 (forward-sexp 1)
1231 ;; Skip arguments. 1323 ;; Skip arguments.
1232 (while (looking-at "[ \t]*\\s(") (forward-sexp))))) 1324 (while (looking-at "[ \t]*[[{(]")
1325 (with-syntax-table tex-mode-syntax-table
1326 (forward-sexp))))))
1233 1327
1234(defun tex-close-latex-block () 1328(defalias 'tex-close-latex-block 'latex-close-block)
1235 "Creates an \\end{...} to match the last unclosed \\begin{...}." 1329(define-skeleton latex-close-block
1236 (interactive "*") 1330 "Create an \\end{...} to match the last unclosed \\begin{...}."
1237 (let ((new-line-needed (bolp)) 1331 (save-excursion
1238 text indentation) 1332 (tex-last-unended-begin)
1239 (save-excursion 1333 (if (not (looking-at "\\\\begin\\(\\s *{[^}\n]*}\\)")) '("{" _ "}")
1240 (condition-case nil 1334 (match-string 1)))
1241 (tex-last-unended-begin) 1335 \n "\\end" str > \n)
1242 (error (error "Couldn't find unended \\begin"))) 1336
1243 (setq indentation (current-column)) 1337(define-skeleton latex-split-block
1244 (re-search-forward "\\\\begin\\(\\s *{[^}\n]*}\\)") 1338 "Split the enclosing environment by inserting \\end{..}\\begin{..} at point."
1245 (setq text (buffer-substring (match-beginning 1) (match-end 1)))) 1339 (save-excursion
1246 (indent-to indentation) 1340 (tex-last-unended-begin)
1247 (insert "\\end" text) 1341 (if (not (looking-at "\\\\begin\\(\\s *{[^}\n]*}\\)")) '("{" _ "}")
1248 (if new-line-needed (insert ?\n)))) 1342 (prog1 (match-string 1)
1343 (goto-char (match-end 1))
1344 (setq v1 (buffer-substring (point)
1345 (progn
1346 (while (looking-at "[ \t]*[[{]")
1347 (forward-sexp 1))
1348 (point)))))))
1349 \n "\\end" str > \n _ \n "\\begin" str v1 > \n)
1249 1350
1250(defconst tex-discount-args-cmds 1351(defconst tex-discount-args-cmds
1251 '("begin" "end" "input" "special" "cite" "ref" "include" "includeonly" 1352 '("begin" "end" "input" "special" "cite" "ref" "include" "includeonly"
@@ -1866,16 +1967,19 @@ Runs the shell command defined by `tex-show-queue-command'."
1866 :copy tex-mode-syntax-table) 1967 :copy tex-mode-syntax-table)
1867 1968
1868(defun latex-indent (&optional arg) 1969(defun latex-indent (&optional arg)
1869 (with-syntax-table tex-latex-indent-syntax-table 1970 (if (and (eq (get-text-property (line-beginning-position) 'face)
1870 ;; TODO: Rather than ignore $, we should try to be more clever about it. 1971 tex-verbatim-face))
1871 (let ((indent 1972 (indent-relative)
1872 (save-excursion 1973 (with-syntax-table tex-latex-indent-syntax-table
1873 (beginning-of-line) 1974 ;; TODO: Rather than ignore $, we should try to be more clever about it.
1874 (latex-find-indent)))) 1975 (let ((indent
1875 (if (< indent 0) (setq indent 0)) 1976 (save-excursion
1876 (if (<= (current-column) (current-indentation)) 1977 (beginning-of-line)
1877 (indent-line-to indent) 1978 (latex-find-indent))))
1878 (save-excursion (indent-line-to indent)))))) 1979 (if (< indent 0) (setq indent 0))
1980 (if (<= (current-column) (current-indentation))
1981 (indent-line-to indent)
1982 (save-excursion (indent-line-to indent)))))))
1879 1983
1880(defun latex-find-indent (&optional virtual) 1984(defun latex-find-indent (&optional virtual)
1881 "Find the proper indentation of text after point. 1985 "Find the proper indentation of text after point.
@@ -1885,9 +1989,15 @@ There might be text before point."
1885 (save-excursion 1989 (save-excursion
1886 (skip-chars-forward " \t") 1990 (skip-chars-forward " \t")
1887 (or 1991 (or
1992 ;; Stick the first line at column 0.
1993 (and (= (point-min) (line-beginning-position)) 0)
1888 ;; Trust the current indentation, if such info is applicable. 1994 ;; Trust the current indentation, if such info is applicable.
1889 (and virtual (>= (current-indentation) (current-column)) 1995 (and virtual (save-excursion (skip-chars-backward " \t&") (bolp))
1890 (current-indentation)) 1996 (current-column))
1997 ;; Stick verbatim environments to the left margin.
1998 (and (looking-at "\\\\\\(begin\\|end\\) *{\\([^\n}]+\\)")
1999 (member (match-string 2) tex-verbatim-environments)
2000 0)
1891 ;; Put leading close-paren where the matching open brace would be. 2001 ;; Put leading close-paren where the matching open brace would be.
1892 (and (eq (latex-syntax-after) ?\)) 2002 (and (eq (latex-syntax-after) ?\))
1893 (ignore-errors 2003 (ignore-errors
@@ -1918,7 +2028,7 @@ There might be text before point."
1918 (> pos (progn (latex-down-list) 2028 (> pos (progn (latex-down-list)
1919 (forward-comment (point-max)) 2029 (forward-comment (point-max))
1920 (point)))) 2030 (point))))
1921 ;; Align with the first element after the open-paren. 2031 ;; Align with the first element after the open-paren.
1922 (current-column) 2032 (current-column)
1923 ;; We're the first element after a hanging brace. 2033 ;; We're the first element after a hanging brace.
1924 (goto-char up-list-pos) 2034 (goto-char up-list-pos)
@@ -1928,8 +2038,8 @@ There might be text before point."
1928 ;; Nothing particular here: just keep the same indentation. 2038 ;; Nothing particular here: just keep the same indentation.
1929 (+ indent (current-column))) 2039 (+ indent (current-column)))
1930 ;; We're now looking at a macro call. 2040 ;; We're now looking at a macro call.
1931 ((looking-at tex-indent-item-re) 2041 ((looking-at tex-indent-item-re)
1932 ;; Indenting relative to an item, have to re-add the outdenting. 2042 ;; Indenting relative to an item, have to re-add the outdenting.
1933 (+ indent (current-column) tex-indent-item)) 2043 (+ indent (current-column) tex-indent-item))
1934 (t 2044 (t
1935 (let ((col (current-column))) 2045 (let ((col (current-column)))
@@ -1937,11 +2047,11 @@ There might be text before point."
1937 ;; If the first char was not an open-paren, there's 2047 ;; If the first char was not an open-paren, there's
1938 ;; a risk that this is really not an argument to the 2048 ;; a risk that this is really not an argument to the
1939 ;; macro at all. 2049 ;; macro at all.
1940 (+ indent col) 2050 (+ indent col)
1941 (forward-sexp 1) 2051 (forward-sexp 1)
1942 (if (< (line-end-position) 2052 (if (< (line-end-position)
1943 (save-excursion (forward-comment (point-max)) 2053 (save-excursion (forward-comment (point-max))
1944 (point))) 2054 (point)))
1945 ;; we're indenting the first argument. 2055 ;; we're indenting the first argument.
1946 (min (current-column) (+ tex-indent-arg col)) 2056 (min (current-column) (+ tex-indent-arg col))
1947 (skip-syntax-forward " ") 2057 (skip-syntax-forward " ")