/[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.85 by rms, Mon Nov 7 00:50:01 2005 UTC revision 1.86 by rms, Mon Nov 14 04:53:00 2005 UTC
# Line 947  Mostly we check word delimiters." Line 947  Mostly we check word delimiters."
947                              (sort (car (cdr (cdr poss))) 'string<)                              (sort (car (cdr (cdr poss))) 'string<)
948                            (car (cdr (cdr poss)))))))                            (car (cdr (cdr poss)))))))
949      (if flyspell-issue-message-flag      (if flyspell-issue-message-flag
950          (message "mispelling `%s'  %S" word replacements))))          (message "misspelling `%s'  %S" word replacements))))
951    
952  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
953  ;*    flyspell-word-search-backward ...                                */  ;*    flyspell-word-search-backward ...                                */
# Line 1375  The buffer to mark them in is `flyspell- Line 1375  The buffer to mark them in is `flyspell-
1375    (setq flyspell-external-ispell-buffer nil))    (setq flyspell-external-ispell-buffer nil))
1376    
1377  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1378    ;*    flyspell-process-localwords ...                                  */
1379    ;*    -------------------------------------------------------------    */
1380    ;*    This function is used to prevent marking of words explicitly     */
1381    ;*    declared correct.                                                */
1382    ;*---------------------------------------------------------------------*/
1383    (defun flyspell-process-localwords (misspellings-buffer)
1384      (let (localwords
1385            (ispell-casechars (ispell-get-casechars)))
1386        ;; Get localwords from the original buffer
1387        (save-excursion
1388          (goto-char (point-min))
1389          ;; Localwords parsing copied from ispell.el.
1390          (while (search-forward ispell-words-keyword nil t)
1391            (let ((end (save-excursion (end-of-line) (point)))
1392                  string)
1393              ;; buffer-local words separated by a space, and can contain
1394              ;; any character other than a space.  Not rigorous enough.
1395              (while (re-search-forward " *\\([^ ]+\\)" end t)
1396                (setq string (buffer-substring-no-properties (match-beginning 1)
1397                                                             (match-end 1)))
1398                ;; This can fail when string contains a word with invalid chars.
1399                ;; Error handling needs to be added between Ispell and Emacs.
1400                (if (and (< 1 (length string))    
1401                         (equal 0 (string-match ispell-casechars string)))
1402                    (push string localwords))))))
1403        ;; Remove localwords matches from misspellings-buffer.
1404        ;; The usual mechanism of communicating the local words to ispell
1405        ;; does not affect the special ispell process used by
1406        ;; flyspell-large-region.
1407        (with-current-buffer misspellings-buffer
1408          (save-excursion
1409            (dolist (word localwords)
1410              (goto-char (point-min))
1411              (let ((regexp (concat "^" word "\n")))
1412                (while (re-search-forward regexp nil t)
1413                  (delete-region (match-beginning 0) (match-end 0)))))))))
1414    
1415    ;*---------------------------------------------------------------------*/
1416  ;*    flyspell-large-region ...                                        */  ;*    flyspell-large-region ...                                        */
1417  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1418  (defun flyspell-large-region (beg end)  (defun flyspell-large-region (beg end)
# Line 1384  The buffer to mark them in is `flyspell- Line 1422  The buffer to mark them in is `flyspell-
1422      (setq flyspell-large-region-buffer curbuf)      (setq flyspell-large-region-buffer curbuf)
1423      (setq flyspell-large-region-beg beg)      (setq flyspell-large-region-beg beg)
1424      (setq flyspell-large-region-end end)      (setq flyspell-large-region-end end)
1425        (flyspell-accept-buffer-local-defs)
1426      (set-buffer buffer)      (set-buffer buffer)
1427      (erase-buffer)      (erase-buffer)
1428      ;; this is done, we can start checking...      ;; this is done, we can start checking...
# Line 1416  The buffer to mark them in is `flyspell- Line 1455  The buffer to mark them in is `flyspell-
1455                        (setq args (append args ispell-extra-args))                        (setq args (append args ispell-extra-args))
1456                        args))))                        args))))
1457        (if (eq c 0)        (if (eq c 0)
1458            (flyspell-external-point-words)            (progn
1459                (flyspell-process-localwords buffer)
1460                (with-current-buffer curbuf
1461                  (flyspell-delete-region-overlays beg end))
1462                (flyspell-external-point-words))
1463          (error "Can't check region...")))))          (error "Can't check region...")))))
1464    
1465  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
# Line 1503  FLYSPELL-BUFFER." Line 1546  FLYSPELL-BUFFER."
1546    (and (overlayp o) (overlay-get o 'flyspell-overlay)))    (and (overlayp o) (overlay-get o 'flyspell-overlay)))
1547    
1548  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1549  ;*    flyspell-delete-all-overlays ...                                 */  ;*    flyspell-delete-region-overlays, flyspell-delete-all-overlays    */
1550  ;*    -------------------------------------------------------------    */  ;*    -------------------------------------------------------------    */
1551  ;*    Remove all the overlays introduced by flyspell.                  */  ;*    Remove overlays introduced by flyspell.                          */
1552  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1553  (defun flyspell-delete-all-overlays ()  (defun flyspell-delete-region-overlays (beg end)
1554    "Delete all the overlays used by flyspell."    "Delete overlays used by flyspell in a given region."
1555    (let ((l (overlays-in (point-min) (point-max))))    (let ((l (overlays-in beg end)))
1556      (while (consp l)      (while (consp l)
1557        (progn        (progn
1558          (if (flyspell-overlay-p (car l))          (if (flyspell-overlay-p (car l))
1559              (delete-overlay (car l)))              (delete-overlay (car l)))
1560          (setq l (cdr l))))))          (setq l (cdr l))))))
1561    
1562    
1563    (defun flyspell-delete-all-overlays ()
1564      "Delete all the overlays used by flyspell."
1565      (flyspell-delete-region-overlays (point-min) (point-max)))
1566    
1567  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/
1568  ;*    flyspell-unhighlight-at ...                                      */  ;*    flyspell-unhighlight-at ...                                      */
1569  ;*---------------------------------------------------------------------*/  ;*---------------------------------------------------------------------*/

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.86

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