diff options
| author | Richard M. Stallman | 2005-10-10 01:14:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-10-10 01:14:28 +0000 |
| commit | cc8556d9763db3924cabcf8f874e76bf988eb4ae (patch) | |
| tree | e36a61239f09a5570d2fd81dadebfc67d0f99ae7 | |
| parent | 7cf7e30ff4ee5ac8e8c1b4e3ec49226abb96bc7d (diff) | |
| download | emacs-cc8556d9763db3924cabcf8f874e76bf988eb4ae.tar.gz emacs-cc8556d9763db3924cabcf8f874e76bf988eb4ae.zip | |
(flyspell-external-point-words): Simplify logic, and don't try to
check for consecutive appearances of one incorrect word.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 74 |
2 files changed, 41 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2b7659bcd7f..60e1924206d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2005-10-09 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * textmodes/flyspell.el (flyspell-external-point-words): Simplify | ||
| 4 | logic, and don't try to check for consecutive appearances of one | ||
| 5 | incorrect word. | ||
| 6 | |||
| 1 | 2005-10-10 Nick Roberts <nickrob@snap.net.nz> | 7 | 2005-10-10 Nick Roberts <nickrob@snap.net.nz> |
| 2 | 8 | ||
| 3 | * speedbar.el (speedbar-buffer-easymenu-definition): Add menu | 9 | * speedbar.el (speedbar-buffer-easymenu-definition): Add menu |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index bd91e2b9b3d..10d61e0852a 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -1322,47 +1322,43 @@ Word syntax described by `flyspell-dictionary-alist' (which see)." | |||
| 1322 | ;* flyspell-external-point-words ... */ | 1322 | ;* flyspell-external-point-words ... */ |
| 1323 | ;*---------------------------------------------------------------------*/ | 1323 | ;*---------------------------------------------------------------------*/ |
| 1324 | (defun flyspell-external-point-words () | 1324 | (defun flyspell-external-point-words () |
| 1325 | (let ((buffer flyspell-external-ispell-buffer)) | 1325 | "Mark words from a buffer listing incorrect words in order of appearance. |
| 1326 | (set-buffer buffer) | 1326 | The list of incorrect words should be in `flyspell-external-ispell-buffer'. |
| 1327 | \(We finish by killing that buffer and setting the variable to nil.) | ||
| 1328 | The buffer to mark them in is `flyspell-large-region-buffer'." | ||
| 1329 | |||
| 1330 | (with-current-buffer flyspell-external-ispell-buffer | ||
| 1327 | (goto-char (point-min)) | 1331 | (goto-char (point-min)) |
| 1328 | (let ((pword "") | 1332 | ;; Loop over incorrect words. |
| 1329 | (pcount 1)) | 1333 | (while (re-search-forward "\\([^\n]+\\)\n" (point-max) t) |
| 1330 | ;; now we are done with ispell, we have to find the word in | 1334 | ;; Bind WORD to the next one. |
| 1331 | ;; the initial buffer | 1335 | (let ((word (match-string 1))) |
| 1332 | (while (< (point) (- (point-max) 1)) | 1336 | ;; Here there used to be code to see if WORD is the same |
| 1333 | ;; we have to fetch the incorrect word | 1337 | ;; as the previous iteration, and count the number of consecutive |
| 1334 | (if (re-search-forward "\\([^\n]+\\)\n" (point-max) t) | 1338 | ;; identical words, and the loop below would search for that many. |
| 1335 | (let ((word (match-string 1))) | 1339 | ;; That code seemed to be incorrect, and on principle, should |
| 1336 | (if (string= word pword) | 1340 | ;; be unnecessary too. -- rms. |
| 1337 | (setq pcount (1+ pcount)) | 1341 | (if flyspell-issue-message-flag |
| 1338 | (progn | 1342 | (message "Spell Checking...%d%% [%s]" |
| 1339 | (setq pword word) | 1343 | (* 100 (/ (float (point)) (point-max))) |
| 1340 | (setq pcount 1))) | 1344 | word)) |
| 1341 | (goto-char (match-end 0)) | 1345 | ;; Search the other buffer for occurrences of this word, |
| 1342 | (if flyspell-issue-message-flag | 1346 | ;; and check them. Stop when we find one that reports "incorrect". |
| 1343 | (message "Spell Checking...%d%% [%s]" | 1347 | ;; (I don't understand the reason for that logic, |
| 1344 | (* 100 (/ (float (point)) (point-max))) | 1348 | ;; but I didn't want to change it. -- rms.) |
| 1345 | word)) | 1349 | (with-current-buffer flyspell-large-region-buffer |
| 1346 | (set-buffer flyspell-large-region-buffer) | 1350 | (goto-char flyspell-large-region-beg) |
| 1347 | (goto-char flyspell-large-region-beg) | 1351 | (let ((keep t)) |
| 1348 | (let ((keep t) | 1352 | (while (and keep |
| 1349 | (n 0)) | 1353 | (search-forward word flyspell-large-region-end t)) |
| 1350 | (while (and (or (< n pcount) keep) | 1354 | (goto-char (- (point) 1)) |
| 1351 | (search-forward word flyspell-large-region-end t)) | 1355 | (setq keep (flyspell-word))) |
| 1352 | (progn | 1356 | (setq flyspell-large-region-beg (point)))))) |
| 1353 | (goto-char (- (point) 1)) | ||
| 1354 | (setq n (1+ n)) | ||
| 1355 | (setq keep (flyspell-word)))) | ||
| 1356 | (if (= n pcount) | ||
| 1357 | (setq flyspell-large-region-beg (point)))) | ||
| 1358 | (set-buffer buffer)) | ||
| 1359 | (goto-char (point-max))))) | ||
| 1360 | ;; we are done | 1357 | ;; we are done |
| 1361 | (if flyspell-issue-message-flag (message "Spell Checking completed.")) | 1358 | (if flyspell-issue-message-flag (message "Spell Checking completed."))) |
| 1362 | ;; ok, we are done with pointing out incorrect words, we just | 1359 | ;; Kill and forget the buffer with the list of incorrect words. |
| 1363 | ;; have to kill the temporary buffer | 1360 | (kill-buffer flyspell-external-ispell-buffer) |
| 1364 | (kill-buffer flyspell-external-ispell-buffer) | 1361 | (setq flyspell-external-ispell-buffer nil)) |
| 1365 | (setq flyspell-external-ispell-buffer nil))) | ||
| 1366 | 1362 | ||
| 1367 | ;*---------------------------------------------------------------------*/ | 1363 | ;*---------------------------------------------------------------------*/ |
| 1368 | ;* flyspell-large-region ... */ | 1364 | ;* flyspell-large-region ... */ |