diff options
| author | Eli Zaretskii | 2015-07-25 12:35:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-07-25 12:35:16 +0300 |
| commit | 5e63841f2847b0b07cf15aed98c26fe914e9804a (patch) | |
| tree | 5be6e492c0ce4b918423df38ba4629538660882a | |
| parent | cbb289e13eff6b187a942658971aa5419e3ed920 (diff) | |
| download | emacs-5e63841f2847b0b07cf15aed98c26fe914e9804a.tar.gz emacs-5e63841f2847b0b07cf15aed98c26fe914e9804a.zip | |
Fix flyspell-check-previous-highlighted-word
* lisp/textmodes/flyspell.el
(flyspell-check-previous-highlighted-word): Really accept a
numeric argument, as the doc string describes. Fix an off-by-one
error in looking up overlays, so invocation with point immediately
after a word would check that word. Clarify the doc string as
Suggested by N. Jackson <nljlistbox2@gmail.com>. (Bug#21129)
| -rw-r--r-- | lisp/textmodes/flyspell.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index a5dff077b1a..2329f29bdca 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -1827,11 +1827,12 @@ as returned by `ispell-parse-output'." | |||
| 1827 | ;;* flyspell-check-previous-highlighted-word ... */ | 1827 | ;;* flyspell-check-previous-highlighted-word ... */ |
| 1828 | ;;*---------------------------------------------------------------------*/ | 1828 | ;;*---------------------------------------------------------------------*/ |
| 1829 | (defun flyspell-check-previous-highlighted-word (&optional arg) | 1829 | (defun flyspell-check-previous-highlighted-word (&optional arg) |
| 1830 | "Correct the closer misspelled word. | 1830 | "Correct the closest previous word that is highlighted as misspelled. |
| 1831 | This function scans a mis-spelled word before the cursor. If it finds one | 1831 | This function scans for a word which starts before point that has been |
| 1832 | it proposes replacement for that word. With prefix arg, count that many | 1832 | highlighted by Flyspell as misspelled. If it finds one, it proposes |
| 1833 | misspelled words backwards." | 1833 | a replacement for that word. With prefix arg N, check the Nth word |
| 1834 | (interactive) | 1834 | before point that's highlighted as misspelled." |
| 1835 | (interactive "P") | ||
| 1835 | (let ((pos1 (point)) | 1836 | (let ((pos1 (point)) |
| 1836 | (pos (point)) | 1837 | (pos (point)) |
| 1837 | (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) | 1838 | (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) |
| @@ -1842,7 +1843,7 @@ misspelled words backwards." | |||
| 1842 | (setq pos1 pos) | 1843 | (setq pos1 pos) |
| 1843 | (if (> pos (point-min)) | 1844 | (if (> pos (point-min)) |
| 1844 | (progn | 1845 | (progn |
| 1845 | (setq ovs (overlays-at (1- pos))) | 1846 | (setq ovs (overlays-at pos)) |
| 1846 | (while (consp ovs) | 1847 | (while (consp ovs) |
| 1847 | (setq ov (car ovs)) | 1848 | (setq ov (car ovs)) |
| 1848 | (setq ovs (cdr ovs)) | 1849 | (setq ovs (cdr ovs)) |