# HG changeset patch # User Martin Rudalics # Date 1222151731 0 # Node ID 01cf1247cab622f78a38bd1d10c9d24ee9ee9b0b # Parent 9062732fe4b3de5a60202c9c8f0a4ac22fb335af (latex-find-indent): ... and don't change original position when it fails. diff -r 9062732fe4b3 -r 01cf1247cab6 lisp/textmodes/tex-mode.el --- a/lisp/textmodes/tex-mode.el Tue Sep 23 06:15:52 2008 +0000 +++ b/lisp/textmodes/tex-mode.el Tue Sep 23 06:35:31 2008 +0000 @@ -2586,15 +2586,18 @@ (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.