comparison lisp/textmodes/flyspell.el @ 67595:ce27da2c8c63

(flyspell-external-point-words): Use save-excursion to ensure we don't move backward in the search loop, not even one character. (flyspell-delete-all-overlays): Use remove-overlays directly.
author Richard M. Stallman <rms@gnu.org>
date Fri, 16 Dec 2005 02:02:42 +0000
parents a52ff1637e2f
children 88f36bfe01f5
comparison
equal deleted inserted replaced
67594:9a94da622aa0 67595:ce27da2c8c63
1330 ;; Iterate on string search until string is found as word, 1330 ;; Iterate on string search until string is found as word,
1331 ;; not as substring 1331 ;; not as substring
1332 (while keep 1332 (while keep
1333 (if (search-forward word 1333 (if (search-forward word
1334 flyspell-large-region-end t) 1334 flyspell-large-region-end t)
1335 (progn 1335 (save-excursion
1336 (goto-char (- (point) 1)) 1336 (goto-char (- (point) 1))
1337 (let* ((match-point (point)) ; flyspell-get-word might move it 1337 (let* ((flyword-prev-l (flyspell-get-word nil))
1338 (flyword-prev-l (flyspell-get-word nil))
1339 (flyword-prev (car flyword-prev-l)) 1338 (flyword-prev (car flyword-prev-l))
1340 (size-match (= (length flyword-prev) (length word)))) 1339 (size-match (= (length flyword-prev) (length word))))
1341 (when (or 1340 (when (or
1342 ;; size matches, we are done 1341 ;; size matches, we are done
1343 size-match 1342 size-match
1360 t 1359 t
1361 nil)))) 1360 nil))))
1362 (setq keep nil) 1361 (setq keep nil)
1363 (flyspell-word) 1362 (flyspell-word)
1364 ;; Next search will begin from end of last match 1363 ;; Next search will begin from end of last match
1365 (setq flyspell-large-region-beg match-point)))) 1364 )))
1366 ;; Record if misspelling is not found and try new one 1365 ;; Record if misspelling is not found and try new one
1367 (add-to-list 'words-not-found 1366 (add-to-list 'words-not-found
1368 (concat " -> " word " - " 1367 (concat " -> " word " - "
1369 (int-to-string wordpos))) 1368 (int-to-string wordpos)))
1370 (setq keep nil))))))) 1369 (setq keep nil)))))))
1556 (remove-overlays beg end 'flyspell-overlay t)) 1555 (remove-overlays beg end 'flyspell-overlay t))
1557 1556
1558 1557
1559 (defun flyspell-delete-all-overlays () 1558 (defun flyspell-delete-all-overlays ()
1560 "Delete all the overlays used by flyspell." 1559 "Delete all the overlays used by flyspell."
1561 (flyspell-delete-region-overlays (point-min) (point-max))) 1560 (remove-overlays (point-min) (point-max) 'flyspell-overlay t))
1562 1561
1563 ;;*---------------------------------------------------------------------*/ 1562 ;;*---------------------------------------------------------------------*/
1564 ;;* flyspell-unhighlight-at ... */ 1563 ;;* flyspell-unhighlight-at ... */
1565 ;;*---------------------------------------------------------------------*/ 1564 ;;*---------------------------------------------------------------------*/
1566 (defun flyspell-unhighlight-at (pos) 1565 (defun flyspell-unhighlight-at (pos)