Function: flyspell-maybe-correct-doubling

flyspell-maybe-correct-doubling is a byte-compiled function defined in flyspell.el.gz.

Signature

(flyspell-maybe-correct-doubling BEG END POSS)

Documentation

Check replacements for doubled characters.

If the text between BEG and END is equal to a correction suggested by Ispell, after removing a pair of doubled characters, correct the text, and return t.

The third arg POSS is either the symbol doublon or a list of possible corrections as returned by ispell-parse-output.

This function is meant to be added to flyspell-incorrect-hook.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/flyspell.el.gz
(defun flyspell-maybe-correct-doubling (beg end poss)
  "Check replacements for doubled characters.

If the text between BEG and END is equal to a correction suggested by
Ispell, after removing a pair of doubled characters, correct the text,
and return t.

The third arg POSS is either the symbol `doublon' or a list of
possible corrections as returned by `ispell-parse-output'.

This function is meant to be added to `flyspell-incorrect-hook'."
  (when (consp poss)
    (catch 'done
      (let ((str (buffer-substring beg end))
	    (i 0) (len (- end beg)))
	(while (< (1+ i) len)
	  (when (and (= (aref str i) (aref str (1+ i)))
		     (member (concat (substring str 0 (1+ i))
				     (substring str (+ i 2)))
			     (nth 2 poss)))
	    (goto-char (+ beg i))
	    (delete-char 1)
	    (throw 'done t))
	  (setq i (1+ i))))
      nil)))