]> git.eshelyaron.com Git - emacs.git/commitdiff
(latex-find-indent): ... and don't change original position when
authorMartin Rudalics <rudalics@gmx.at>
Tue, 23 Sep 2008 06:35:31 +0000 (06:35 +0000)
committerMartin Rudalics <rudalics@gmx.at>
Tue, 23 Sep 2008 06:35:31 +0000 (06:35 +0000)
it fails.

lisp/textmodes/tex-mode.el

index eeb562166cb3f1a2f4ba4abb6b94137bd99a8697..2c55a68b57b80eb4d48617a565f538e1f4ac0218 100644 (file)
@@ -2586,15 +2586,18 @@ There might be text before point."
          (member (match-string 2) tex-verbatim-environments)
          0)
      ;; Put leading close-paren where the matching open paren would be.
-     (and (or (eq (latex-syntax-after) ?\))
-             ;; Try to handle escaped close parens.
-             (and (looking-at "\\\\\\([])}]\\)")
-                  (goto-char (match-beginning 1))))
-         (ignore-errors
-           (save-excursion
-             (latex-skip-close-parens)
-             (latex-backward-sexp-1)
-             (latex-find-indent 'virtual))))
+     (and (let (escaped)
+           (or (eq (latex-syntax-after) ?\))
+               ;; Try to handle escaped close parens but keep original
+               ;; position if it doesn't work out.
+               (setq escaped (looking-at "\\\\\\([])}]\\)")))
+           (ignore-errors
+             (save-excursion
+               (when escaped
+                 (goto-char (match-beginning 1)))
+               (latex-skip-close-parens)
+               (latex-backward-sexp-1)
+               (latex-find-indent 'virtual)))))
      ;; Default (maybe an argument)
      (let ((pos (point))
           ;; Outdent \item if necessary.