From 5e63841f2847b0b07cf15aed98c26fe914e9804a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 25 Jul 2015 12:35:16 +0300 Subject: [PATCH] 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 . (Bug#21129) --- lisp/textmodes/flyspell.el | 13 +++++++------ 1 file 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'." ;;* flyspell-check-previous-highlighted-word ... */ ;;*---------------------------------------------------------------------*/ (defun flyspell-check-previous-highlighted-word (&optional arg) - "Correct the closer misspelled word. -This function scans a mis-spelled word before the cursor. If it finds one -it proposes replacement for that word. With prefix arg, count that many -misspelled words backwards." - (interactive) + "Correct the closest previous word that is highlighted as misspelled. +This function scans for a word which starts before point that has been +highlighted by Flyspell as misspelled. If it finds one, it proposes +a replacement for that word. With prefix arg N, check the Nth word +before point that's highlighted as misspelled." + (interactive "P") (let ((pos1 (point)) (pos (point)) (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) @@ -1842,7 +1843,7 @@ misspelled words backwards." (setq pos1 pos) (if (> pos (point-min)) (progn - (setq ovs (overlays-at (1- pos))) + (setq ovs (overlays-at pos)) (while (consp ovs) (setq ov (car ovs)) (setq ovs (cdr ovs)) -- 2.11.4.GIT