(flyspell-external-point-words): Simplify logic, and don't try to
check for consecutive appearances of one incorrect word.
This commit is contained in:
parent
7cf7e30ff4
commit
cc8556d976
2 changed files with 41 additions and 39 deletions
|
@ -1,3 +1,9 @@
|
|||
2005-10-09 Richard M. Stallman <rms@gnu.org>
|
||||
|
||||
* textmodes/flyspell.el (flyspell-external-point-words): Simplify
|
||||
logic, and don't try to check for consecutive appearances of one
|
||||
incorrect word.
|
||||
|
||||
2005-10-10 Nick Roberts <nickrob@snap.net.nz>
|
||||
|
||||
* speedbar.el (speedbar-buffer-easymenu-definition): Add menu
|
||||
|
|
|
@ -1322,47 +1322,43 @@ Word syntax described by `flyspell-dictionary-alist' (which see)."
|
|||
;* flyspell-external-point-words ... */
|
||||
;*---------------------------------------------------------------------*/
|
||||
(defun flyspell-external-point-words ()
|
||||
(let ((buffer flyspell-external-ispell-buffer))
|
||||
(set-buffer buffer)
|
||||
"Mark words from a buffer listing incorrect words in order of appearance.
|
||||
The list of incorrect words should be in `flyspell-external-ispell-buffer'.
|
||||
\(We finish by killing that buffer and setting the variable to nil.)
|
||||
The buffer to mark them in is `flyspell-large-region-buffer'."
|
||||
|
||||
(with-current-buffer flyspell-external-ispell-buffer
|
||||
(goto-char (point-min))
|
||||
(let ((pword "")
|
||||
(pcount 1))
|
||||
;; now we are done with ispell, we have to find the word in
|
||||
;; the initial buffer
|
||||
(while (< (point) (- (point-max) 1))
|
||||
;; we have to fetch the incorrect word
|
||||
(if (re-search-forward "\\([^\n]+\\)\n" (point-max) t)
|
||||
(let ((word (match-string 1)))
|
||||
(if (string= word pword)
|
||||
(setq pcount (1+ pcount))
|
||||
(progn
|
||||
(setq pword word)
|
||||
(setq pcount 1)))
|
||||
(goto-char (match-end 0))
|
||||
(if flyspell-issue-message-flag
|
||||
(message "Spell Checking...%d%% [%s]"
|
||||
(* 100 (/ (float (point)) (point-max)))
|
||||
word))
|
||||
(set-buffer flyspell-large-region-buffer)
|
||||
(goto-char flyspell-large-region-beg)
|
||||
(let ((keep t)
|
||||
(n 0))
|
||||
(while (and (or (< n pcount) keep)
|
||||
(search-forward word flyspell-large-region-end t))
|
||||
(progn
|
||||
(goto-char (- (point) 1))
|
||||
(setq n (1+ n))
|
||||
(setq keep (flyspell-word))))
|
||||
(if (= n pcount)
|
||||
(setq flyspell-large-region-beg (point))))
|
||||
(set-buffer buffer))
|
||||
(goto-char (point-max)))))
|
||||
;; Loop over incorrect words.
|
||||
(while (re-search-forward "\\([^\n]+\\)\n" (point-max) t)
|
||||
;; Bind WORD to the next one.
|
||||
(let ((word (match-string 1)))
|
||||
;; Here there used to be code to see if WORD is the same
|
||||
;; as the previous iteration, and count the number of consecutive
|
||||
;; identical words, and the loop below would search for that many.
|
||||
;; That code seemed to be incorrect, and on principle, should
|
||||
;; be unnecessary too. -- rms.
|
||||
(if flyspell-issue-message-flag
|
||||
(message "Spell Checking...%d%% [%s]"
|
||||
(* 100 (/ (float (point)) (point-max)))
|
||||
word))
|
||||
;; Search the other buffer for occurrences of this word,
|
||||
;; and check them. Stop when we find one that reports "incorrect".
|
||||
;; (I don't understand the reason for that logic,
|
||||
;; but I didn't want to change it. -- rms.)
|
||||
(with-current-buffer flyspell-large-region-buffer
|
||||
(goto-char flyspell-large-region-beg)
|
||||
(let ((keep t))
|
||||
(while (and keep
|
||||
(search-forward word flyspell-large-region-end t))
|
||||
(goto-char (- (point) 1))
|
||||
(setq keep (flyspell-word)))
|
||||
(setq flyspell-large-region-beg (point))))))
|
||||
;; we are done
|
||||
(if flyspell-issue-message-flag (message "Spell Checking completed."))
|
||||
;; ok, we are done with pointing out incorrect words, we just
|
||||
;; have to kill the temporary buffer
|
||||
(kill-buffer flyspell-external-ispell-buffer)
|
||||
(setq flyspell-external-ispell-buffer nil)))
|
||||
(if flyspell-issue-message-flag (message "Spell Checking completed.")))
|
||||
;; Kill and forget the buffer with the list of incorrect words.
|
||||
(kill-buffer flyspell-external-ispell-buffer)
|
||||
(setq flyspell-external-ispell-buffer nil))
|
||||
|
||||
;*---------------------------------------------------------------------*/
|
||||
;* flyspell-large-region ... */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue