diff options
| author | Richard M. Stallman | 2005-11-14 04:53:14 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-11-14 04:53:14 +0000 |
| commit | b8b7c66e1c6f76dd05ec99aa67e5584f2a3b0e1a (patch) | |
| tree | 42c44a9783079009ec808d485af6f74bcbb82be9 | |
| parent | 7e1b6c2c593081462d82d20f1b274482059822c8 (diff) | |
| download | emacs-b8b7c66e1c6f76dd05ec99aa67e5584f2a3b0e1a.tar.gz emacs-b8b7c66e1c6f76dd05ec99aa67e5584f2a3b0e1a.zip | |
(flyspell-large-region): Call flyspell-accept-buffer-local-defs.
(flyspell-notify-misspell): Fix misspelling of "Misspelling".
(flyspell-process-localwords): New function.
(flyspell-large-region): Call flyspell-process-localwords and
flyspell-delete-region-overlays.
(flyspell-delete-region-overlays): New function.
(flyspell-delete-all-overlays): Call that.
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 62 |
2 files changed, 70 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bf51221f4a9..35aa5fca167 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,20 @@ | |||
| 1 | 2005-11-13 Richard M. Stallman <rms@gnu.org> | 1 | 2005-11-13 Richard M. Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * textmodes/flyspell.el (flyspell-large-region): | ||
| 4 | Call flyspell-accept-buffer-local-defs. | ||
| 5 | |||
| 6 | 2005-11-13 Agustin Martin <agustin.martin@hispalinux.es> | ||
| 7 | |||
| 8 | * textmodes/flyspell.el (flyspell-notify-misspell): | ||
| 9 | Fix misspelling of "Misspelling". | ||
| 10 | (flyspell-process-localwords): New function. | ||
| 11 | (flyspell-large-region): Call flyspell-process-localwords and | ||
| 12 | flyspell-delete-region-overlays. | ||
| 13 | (flyspell-delete-region-overlays): New function. | ||
| 14 | (flyspell-delete-all-overlays): Call that. | ||
| 15 | |||
| 16 | 2005-11-13 Richard M. Stallman <rms@gnu.org> | ||
| 17 | |||
| 3 | * help.el (help-for-help-internal): Improve doc of C-h a. | 18 | * help.el (help-for-help-internal): Improve doc of C-h a. |
| 4 | 19 | ||
| 5 | 2005-11-13 Stefan Monnier <monnier@iro.umontreal.ca> | 20 | 2005-11-13 Stefan Monnier <monnier@iro.umontreal.ca> |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index a4d77213aec..0bfdadc28ab 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -947,7 +947,7 @@ Mostly we check word delimiters." | |||
| 947 | (sort (car (cdr (cdr poss))) 'string<) | 947 | (sort (car (cdr (cdr poss))) 'string<) |
| 948 | (car (cdr (cdr poss))))))) | 948 | (car (cdr (cdr poss))))))) |
| 949 | (if flyspell-issue-message-flag | 949 | (if flyspell-issue-message-flag |
| 950 | (message "mispelling `%s' %S" word replacements)))) | 950 | (message "misspelling `%s' %S" word replacements)))) |
| 951 | 951 | ||
| 952 | ;*---------------------------------------------------------------------*/ | 952 | ;*---------------------------------------------------------------------*/ |
| 953 | ;* flyspell-word-search-backward ... */ | 953 | ;* flyspell-word-search-backward ... */ |
| @@ -1375,6 +1375,44 @@ The buffer to mark them in is `flyspell-large-region-buffer'." | |||
| 1375 | (setq flyspell-external-ispell-buffer nil)) | 1375 | (setq flyspell-external-ispell-buffer nil)) |
| 1376 | 1376 | ||
| 1377 | ;*---------------------------------------------------------------------*/ | 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 | ;*---------------------------------------------------------------------*/ | ||
| 1378 | ;* flyspell-large-region ... */ | 1416 | ;* flyspell-large-region ... */ |
| 1379 | ;*---------------------------------------------------------------------*/ | 1417 | ;*---------------------------------------------------------------------*/ |
| 1380 | (defun flyspell-large-region (beg end) | 1418 | (defun flyspell-large-region (beg end) |
| @@ -1384,6 +1422,7 @@ The buffer to mark them in is `flyspell-large-region-buffer'." | |||
| 1384 | (setq flyspell-large-region-buffer curbuf) | 1422 | (setq flyspell-large-region-buffer curbuf) |
| 1385 | (setq flyspell-large-region-beg beg) | 1423 | (setq flyspell-large-region-beg beg) |
| 1386 | (setq flyspell-large-region-end end) | 1424 | (setq flyspell-large-region-end end) |
| 1425 | (flyspell-accept-buffer-local-defs) | ||
| 1387 | (set-buffer buffer) | 1426 | (set-buffer buffer) |
| 1388 | (erase-buffer) | 1427 | (erase-buffer) |
| 1389 | ;; this is done, we can start checking... | 1428 | ;; this is done, we can start checking... |
| @@ -1416,7 +1455,11 @@ The buffer to mark them in is `flyspell-large-region-buffer'." | |||
| 1416 | (setq args (append args ispell-extra-args)) | 1455 | (setq args (append args ispell-extra-args)) |
| 1417 | args)))) | 1456 | args)))) |
| 1418 | (if (eq c 0) | 1457 | (if (eq c 0) |
| 1419 | (flyspell-external-point-words) | 1458 | (progn |
| 1459 | (flyspell-process-localwords buffer) | ||
| 1460 | (with-current-buffer curbuf | ||
| 1461 | (flyspell-delete-region-overlays beg end)) | ||
| 1462 | (flyspell-external-point-words)) | ||
| 1420 | (error "Can't check region..."))))) | 1463 | (error "Can't check region..."))))) |
| 1421 | 1464 | ||
| 1422 | ;*---------------------------------------------------------------------*/ | 1465 | ;*---------------------------------------------------------------------*/ |
| @@ -1503,19 +1546,24 @@ FLYSPELL-BUFFER." | |||
| 1503 | (and (overlayp o) (overlay-get o 'flyspell-overlay))) | 1546 | (and (overlayp o) (overlay-get o 'flyspell-overlay))) |
| 1504 | 1547 | ||
| 1505 | ;*---------------------------------------------------------------------*/ | 1548 | ;*---------------------------------------------------------------------*/ |
| 1506 | ;* flyspell-delete-all-overlays ... */ | 1549 | ;* flyspell-delete-region-overlays, flyspell-delete-all-overlays */ |
| 1507 | ;* ------------------------------------------------------------- */ | 1550 | ;* ------------------------------------------------------------- */ |
| 1508 | ;* Remove all the overlays introduced by flyspell. */ | 1551 | ;* Remove overlays introduced by flyspell. */ |
| 1509 | ;*---------------------------------------------------------------------*/ | 1552 | ;*---------------------------------------------------------------------*/ |
| 1510 | (defun flyspell-delete-all-overlays () | 1553 | (defun flyspell-delete-region-overlays (beg end) |
| 1511 | "Delete all the overlays used by flyspell." | 1554 | "Delete overlays used by flyspell in a given region." |
| 1512 | (let ((l (overlays-in (point-min) (point-max)))) | 1555 | (let ((l (overlays-in beg end))) |
| 1513 | (while (consp l) | 1556 | (while (consp l) |
| 1514 | (progn | 1557 | (progn |
| 1515 | (if (flyspell-overlay-p (car l)) | 1558 | (if (flyspell-overlay-p (car l)) |
| 1516 | (delete-overlay (car l))) | 1559 | (delete-overlay (car l))) |
| 1517 | (setq l (cdr l)))))) | 1560 | (setq l (cdr l)))))) |
| 1518 | 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 | |||
| 1519 | ;*---------------------------------------------------------------------*/ | 1567 | ;*---------------------------------------------------------------------*/ |
| 1520 | ;* flyspell-unhighlight-at ... */ | 1568 | ;* flyspell-unhighlight-at ... */ |
| 1521 | ;*---------------------------------------------------------------------*/ | 1569 | ;*---------------------------------------------------------------------*/ |