aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/textmodes/tex-mode.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index eeb562166cb..2c55a68b57b 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -2586,15 +2586,18 @@ There might be text before point."
2586 (member (match-string 2) tex-verbatim-environments) 2586 (member (match-string 2) tex-verbatim-environments)
2587 0) 2587 0)
2588 ;; Put leading close-paren where the matching open paren would be. 2588 ;; Put leading close-paren where the matching open paren would be.
2589 (and (or (eq (latex-syntax-after) ?\)) 2589 (and (let (escaped)
2590 ;; Try to handle escaped close parens. 2590 (or (eq (latex-syntax-after) ?\))
2591 (and (looking-at "\\\\\\([])}]\\)") 2591 ;; Try to handle escaped close parens but keep original
2592 (goto-char (match-beginning 1)))) 2592 ;; position if it doesn't work out.
2593 (ignore-errors 2593 (setq escaped (looking-at "\\\\\\([])}]\\)")))
2594 (save-excursion 2594 (ignore-errors
2595 (latex-skip-close-parens) 2595 (save-excursion
2596 (latex-backward-sexp-1) 2596 (when escaped
2597 (latex-find-indent 'virtual)))) 2597 (goto-char (match-beginning 1)))
2598 (latex-skip-close-parens)
2599 (latex-backward-sexp-1)
2600 (latex-find-indent 'virtual)))))
2598 ;; Default (maybe an argument) 2601 ;; Default (maybe an argument)
2599 (let ((pos (point)) 2602 (let ((pos (point))
2600 ;; Outdent \item if necessary. 2603 ;; Outdent \item if necessary.