summaryrefslogtreecommitdiff
path: root/lisp/textmodes/tex-mode.el
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2008-09-23 06:35:31 +0000
committerMartin Rudalics <rudalics@gmx.at>2008-09-23 06:35:31 +0000
commitea60d1b14f2d723de74e045d02fbdc51986d56d6 (patch)
tree61870be677550f717b98fae9826934f6baa0684a /lisp/textmodes/tex-mode.el
parentee1751a5e8825dda9a11bff6656aaa5099c394c1 (diff)
downloademacs-ea60d1b14f2d723de74e045d02fbdc51986d56d6.tar.gz
(latex-find-indent): ... and don't change original position when
it fails.
Diffstat (limited to 'lisp/textmodes/tex-mode.el')
-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."
(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.