/[emacs]/emacs/lisp/textmodes/flyspell.el
ViewVC logotype

Diff of /emacs/lisp/textmodes/flyspell.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.77 by rms, Tue Oct 4 20:29:00 2005 UTC revision 1.78 by rms, Mon Oct 10 01:13:22 2005 UTC
# Line 1322  Word syntax described by `flyspell-dicti Line 1322  Word syntax described by `flyspell-dicti
1322  ;*    flyspell-external-point-words ...                                */  ;*    flyspell-external-point-words ...                                */
1323  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1324  (defun flyspell-external-point-words ()  (defun flyspell-external-point-words ()
1325    (let ((buffer flyspell-external-ispell-buffer))    "Mark words from a buffer listing incorrect words in order of appearance.
1326      (set-buffer buffer)  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
1331      (goto-char (point-min))      (goto-char (point-min))
1332      (let ((pword "")      ;; Loop over incorrect words.
1333            (pcount 1))      (while (re-search-forward "\\([^\n]+\\)\n" (point-max) t)
1334        ;; now we are done with ispell, we have to find the word in        ;; Bind WORD to the next one.
1335        ;; the initial buffer        (let ((word (match-string 1)))
1336        (while (< (point) (- (point-max) 1))          ;; Here there used to be code to see if WORD is the same
1337          ;; we have to fetch the incorrect word          ;; as the previous iteration, and count the number of consecutive
1338          (if (re-search-forward "\\([^\n]+\\)\n" (point-max) t)          ;; identical words, and the loop below would search for that many.
1339              (let ((word (match-string 1)))          ;; That code seemed to be incorrect, and on principle, should
1340                (if (string= word pword)          ;; be unnecessary too. -- rms.
1341                    (setq pcount (1+ pcount))          (if flyspell-issue-message-flag
1342                  (progn              (message "Spell Checking...%d%% [%s]"
1343                    (setq pword word)                       (* 100 (/ (float (point)) (point-max)))
1344                    (setq pcount 1)))                       word))
1345                (goto-char (match-end 0))          ;; Search the other buffer for occurrences of this word,
1346                (if flyspell-issue-message-flag          ;; and check them.  Stop when we find one that reports "incorrect".
1347                    (message "Spell Checking...%d%% [%s]"          ;; (I don't understand the reason for that logic,
1348                             (* 100 (/ (float (point)) (point-max)))          ;; but I didn't want to change it. -- rms.)
1349                             word))          (with-current-buffer flyspell-large-region-buffer
1350                (set-buffer flyspell-large-region-buffer)            (goto-char flyspell-large-region-beg)
1351                (goto-char flyspell-large-region-beg)            (let ((keep t))
1352                (let ((keep t)              (while (and keep
1353                      (n 0))                          (search-forward word flyspell-large-region-end t))
1354                  (while (and (or (< n pcount) keep)                (goto-char (- (point) 1))
1355                              (search-forward word flyspell-large-region-end t))                (setq keep (flyspell-word)))
1356                    (progn              (setq flyspell-large-region-beg (point))))))
                     (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)))))  
1357      ;; we are done      ;; we are done
1358      (if flyspell-issue-message-flag (message "Spell Checking completed."))      (if flyspell-issue-message-flag (message "Spell Checking completed.")))
1359      ;; ok, we are done with pointing out incorrect words, we just    ;; Kill and forget the buffer with the list of incorrect words.
1360      ;; have to kill the temporary buffer    (kill-buffer flyspell-external-ispell-buffer)
1361      (kill-buffer flyspell-external-ispell-buffer)    (setq flyspell-external-ispell-buffer nil))
     (setq flyspell-external-ispell-buffer nil)))  
1362    
1363  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1364  ;*    flyspell-large-region ...                                        */  ;*    flyspell-large-region ...                                        */

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26