comparison lisp/textmodes/tex-mode.el @ 98309:01cf1247cab6

(latex-find-indent): ... and don't change original position when it fails.
author Martin Rudalics <rudalics@gmx.at>
date Tue, 23 Sep 2008 06:35:31 +0000
parents 37a6a06b7e9a
children d8a3b46ba292
comparison
equal deleted inserted replaced
98308:9062732fe4b3 98309:01cf1247cab6
2584 ;; Stick verbatim environments to the left margin. 2584 ;; Stick verbatim environments to the left margin.
2585 (and (looking-at "\\\\\\(begin\\|end\\) *{\\([^\n}]+\\)") 2585 (and (looking-at "\\\\\\(begin\\|end\\) *{\\([^\n}]+\\)")
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.
2601 (indent (if (looking-at tex-indent-item-re) (- tex-indent-item) 0)) 2604 (indent (if (looking-at tex-indent-item-re) (- tex-indent-item) 0))
2602 up-list-pos) 2605 up-list-pos)