aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2007-09-20 03:06:38 +0000
committerGlenn Morris2007-09-20 03:06:38 +0000
commit98fcc75bb3c25c9db433b81b1582b05009f738ab (patch)
tree3a5ffe83a6ff9ca6c6e2970eb603d5b28796d931 /lisp
parent8a94087164aad1909673399fea77a4d61b35459a (diff)
downloademacs-98fcc75bb3c25c9db433b81b1582b05009f738ab.tar.gz
emacs-98fcc75bb3c25c9db433b81b1582b05009f738ab.zip
(tex-validate-buffer): Use paragraph motion functions, rather than
hard-coding "\n\n". (tex-validate-region): Check for eobp, to speed up. (tex-next-unmatched-end): Doc fix.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/tex-mode.el42
1 files changed, 23 insertions, 19 deletions
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index e93894267ff..54b592e4845 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1163,25 +1163,27 @@ on the line for the invalidity you want to see."
1163 (setq occur-revert-arguments (list nil 0 (list buffer)))) 1163 (setq occur-revert-arguments (list nil 0 (list buffer))))
1164 (save-excursion 1164 (save-excursion
1165 (goto-char (point-max)) 1165 (goto-char (point-max))
1166 (while (and (not (bobp))) 1166 ;; Do a little shimmy to place point at the end of the last
1167 (let ((end (point)) 1167 ;; "real" paragraph. Need to avoid validating across an \end,
1168 prev-end) 1168 ;; because that blows up latex-forward-sexp.
1169 ;; Scan the previous paragraph for invalidities. 1169 (backward-paragraph)
1170 ;; FIXME this should be using something like backward-paragraph. 1170 (forward-paragraph)
1171 (if (search-backward "\n\n" nil t) 1171 (while (not (bobp))
1172 (progn 1172 ;; Scan the previous paragraph for invalidities.
1173 (setq prev-end (point)) 1173 (backward-paragraph)
1174 (forward-char 2)) 1174 (save-excursion
1175 (goto-char (setq prev-end (point-min)))) 1175 (or (tex-validate-region (point) (save-excursion
1176 (or (tex-validate-region (point) end) 1176 (forward-paragraph)
1177 (let* ((end (line-beginning-position 2)) 1177 (point)))
1178 start tem) 1178 (let ((end (line-beginning-position 2))
1179 start tem)
1179 (beginning-of-line) 1180 (beginning-of-line)
1180 (setq start (point)) 1181 (setq start (point))
1181 ;; Keep track of line number as we scan, 1182 ;; Keep track of line number as we scan,
1182 ;; in a cumulative fashion. 1183 ;; in a cumulative fashion.
1183 (if linenum 1184 (if linenum
1184 (setq linenum (- linenum (count-lines prevpos (point)))) 1185 (setq linenum (- linenum
1186 (count-lines prevpos (point))))
1185 (setq linenum (1+ (count-lines 1 start)))) 1187 (setq linenum (1+ (count-lines 1 start))))
1186 (setq prevpos (point)) 1188 (setq prevpos (point))
1187 ;; Mention this mismatch in *Occur*. 1189 ;; Mention this mismatch in *Occur*.
@@ -1202,10 +1204,10 @@ on the line for the invalidity you want to see."
1202 (add-text-properties 1204 (add-text-properties
1203 text-beg (- text-end 1) 1205 text-beg (- text-end 1)
1204 '(mouse-face highlight 1206 '(mouse-face highlight
1205 help-echo "mouse-2: go to this invalidity")) 1207 help-echo
1208 "mouse-2: go to this invalidity"))
1206 (put-text-property text-beg (- text-end 1) 1209 (put-text-property text-beg (- text-end 1)
1207 'occur-target tem))))) 1210 'occur-target tem))))))))
1208 (goto-char prev-end))))
1209 (with-current-buffer standard-output 1211 (with-current-buffer standard-output
1210 (let ((no-matches (zerop num-matches))) 1212 (let ((no-matches (zerop num-matches)))
1211 (if no-matches 1213 (if no-matches
@@ -1228,7 +1230,9 @@ area if a mismatch is found."
1228 (narrow-to-region start end) 1230 (narrow-to-region start end)
1229 ;; First check that the open and close parens balance in numbers. 1231 ;; First check that the open and close parens balance in numbers.
1230 (goto-char start) 1232 (goto-char start)
1231 (while (<= 0 (setq max-possible-sexps (1- max-possible-sexps))) 1233 (while (and (not (eobp))
1234 (<= 0 (setq max-possible-sexps
1235 (1- max-possible-sexps))))
1232 (forward-sexp 1)) 1236 (forward-sexp 1))
1233 ;; Now check that like matches like. 1237 ;; Now check that like matches like.
1234 (goto-char start) 1238 (goto-char start)
@@ -1367,7 +1371,7 @@ Return the value returned by the last execution of BODY."
1367 (search-failed (error "Couldn't find unended \\begin")))) 1371 (search-failed (error "Couldn't find unended \\begin"))))
1368 1372
1369(defun tex-next-unmatched-end () 1373(defun tex-next-unmatched-end ()
1370 "Leave point at the end of the next `\\end' that is unended." 1374 "Leave point at the end of the next `\\end' that is unmatched."
1371 (while (and (tex-search-noncomment 1375 (while (and (tex-search-noncomment
1372 (re-search-forward "\\\\\\(begin\\|end\\)\\s *{[^}]+}")) 1376 (re-search-forward "\\\\\\(begin\\|end\\)\\s *{[^}]+}"))
1373 (save-excursion (goto-char (match-beginning 0)) 1377 (save-excursion (goto-char (match-beginning 0))