comparison lisp/textmodes/flyspell.el @ 67729:88f36bfe01f5

(flyspell-check-word-p): Don't quote - in a regexp. (tex-mode-flyspell-verify, flyspell-get-word) (flyspell-external-point-words): Don't use point-min/max uselessly.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 22 Dec 2005 01:51:40 +0000
parents ce27da2c8c63
children 35ea50aa6020
comparison
equal deleted inserted replaced
67728:bffc4c57eda9 67729:88f36bfe01f5
322 (put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify) 322 (put 'tex-mode 'flyspell-mode-predicate 'tex-mode-flyspell-verify)
323 (defun tex-mode-flyspell-verify () 323 (defun tex-mode-flyspell-verify ()
324 "This function is used for `flyspell-generic-check-word-p' in LaTeX mode." 324 "This function is used for `flyspell-generic-check-word-p' in LaTeX mode."
325 (and 325 (and
326 (not (save-excursion 326 (not (save-excursion
327 (re-search-backward "^[ \t]*%%%[ \t]+Local" (point-min) t))) 327 (re-search-backward "^[ \t]*%%%[ \t]+Local" nil t)))
328 (not (save-excursion 328 (not (save-excursion
329 (let ((this (point-marker)) 329 (let ((this (point-marker))
330 (e (progn (end-of-line) (point-marker)))) 330 (e (progn (end-of-line) (point-marker))))
331 (beginning-of-line) 331 (beginning-of-line)
332 (if (re-search-forward "\\\\\\(cite\\|label\\|ref\\){[^}]*}" e t) 332 (if (re-search-forward "\\\\\\(cite\\|label\\|ref\\){[^}]*}" e t)
751 (not (eq (current-column) flyspell-pre-column))) 751 (not (eq (current-column) flyspell-pre-column)))
752 (save-excursion 752 (save-excursion
753 (backward-char 1) 753 (backward-char 1)
754 (and (looking-at (flyspell-get-not-casechars)) 754 (and (looking-at (flyspell-get-not-casechars))
755 (or flyspell-consider-dash-as-word-delimiter-flag 755 (or flyspell-consider-dash-as-word-delimiter-flag
756 (not (looking-at "\\-")))))) 756 (not (looking-at "-"))))))
757 ;; yes because we have reached or typed a word delimiter. 757 ;; yes because we have reached or typed a word delimiter.
758 t) 758 t)
759 ((symbolp this-command) 759 ((symbolp this-command)
760 (cond 760 (cond
761 ((get this-command 'flyspell-deplacement) 761 ((get this-command 'flyspell-deplacement)
1223 did-it-once prevpt 1223 did-it-once prevpt
1224 start end word) 1224 start end word)
1225 ;; find the word 1225 ;; find the word
1226 (if (not (looking-at flyspell-casechars)) 1226 (if (not (looking-at flyspell-casechars))
1227 (if following 1227 (if following
1228 (re-search-forward flyspell-casechars (point-max) t) 1228 (re-search-forward flyspell-casechars nil t)
1229 (re-search-backward flyspell-casechars (point-min) t))) 1229 (re-search-backward flyspell-casechars nil t)))
1230 ;; move to front of word 1230 ;; move to front of word
1231 (re-search-backward flyspell-not-casechars (point-min) 'start) 1231 (re-search-backward flyspell-not-casechars nil 'start)
1232 (while (and (or (and (not (string= "" ispell-otherchars)) 1232 (while (and (or (and (not (string= "" ispell-otherchars))
1233 (looking-at ispell-otherchars)) 1233 (looking-at ispell-otherchars))
1234 (and extra-otherchars (looking-at extra-otherchars))) 1234 (and extra-otherchars (looking-at extra-otherchars)))
1235 (not (bobp)) 1235 (not (bobp))
1236 (or (not did-it-once) 1236 (or (not did-it-once)
1238 (not (eq prevpt (point)))) 1238 (not (eq prevpt (point))))
1239 (if (and extra-otherchars (looking-at extra-otherchars)) 1239 (if (and extra-otherchars (looking-at extra-otherchars))
1240 (progn 1240 (progn
1241 (backward-char 1) 1241 (backward-char 1)
1242 (if (looking-at flyspell-casechars) 1242 (if (looking-at flyspell-casechars)
1243 (re-search-backward flyspell-not-casechars (point-min) 'move))) 1243 (re-search-backward flyspell-not-casechars nil 'move)))
1244 (setq did-it-once t 1244 (setq did-it-once t
1245 prevpt (point)) 1245 prevpt (point))
1246 (backward-char 1) 1246 (backward-char 1)
1247 (if (looking-at flyspell-casechars) 1247 (if (looking-at flyspell-casechars)
1248 (re-search-backward flyspell-not-casechars (point-min) 'move) 1248 (re-search-backward flyspell-not-casechars nil 'move)
1249 (backward-char -1)))) 1249 (backward-char -1))))
1250 ;; Now mark the word and save to string. 1250 ;; Now mark the word and save to string.
1251 (if (not (re-search-forward word-regexp (point-max) t)) 1251 (if (not (re-search-forward word-regexp nil t))
1252 nil 1252 nil
1253 (progn 1253 (progn
1254 (setq start (match-beginning 0) 1254 (setq start (match-beginning 0)
1255 end (point) 1255 end (point)
1256 word (buffer-substring-no-properties start end)) 1256 word (buffer-substring-no-properties start end))
1310 (let (words-not-found 1310 (let (words-not-found
1311 (ispell-otherchars (ispell-get-otherchars))) 1311 (ispell-otherchars (ispell-get-otherchars)))
1312 (with-current-buffer flyspell-external-ispell-buffer 1312 (with-current-buffer flyspell-external-ispell-buffer
1313 (goto-char (point-min)) 1313 (goto-char (point-min))
1314 ;; Loop over incorrect words. 1314 ;; Loop over incorrect words.
1315 (while (re-search-forward "\\([^\n]+\\)\n" (point-max) t) 1315 (while (re-search-forward "\\([^\n]+\\)\n" nil t)
1316 ;; Bind WORD to the next one. 1316 ;; Bind WORD to the next one.
1317 (let ((word (match-string 1)) (wordpos (point))) 1317 (let ((word (match-string 1)) (wordpos (point)))
1318 ;; Here there used to be code to see if WORD is the same 1318 ;; Here there used to be code to see if WORD is the same
1319 ;; as the previous iteration, and count the number of consecutive 1319 ;; as the previous iteration, and count the number of consecutive
1320 ;; identical words, and the loop below would search for that many. 1320 ;; identical words, and the loop below would search for that many.