Commit 5e63841f authored by Eli Zaretskii's avatar Eli Zaretskii

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)
parent cbb289e1
......@@ -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."
"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))
(setq ovs (overlays-at (1- pos)))
(setq ovs (overlays-at pos))
(while (consp ovs)
(setq ov (car ovs))
(setq ovs (cdr ovs))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment