"*List of functions to be called when incorrect words are encountered.
Each function is given three arguments: the beginning and the end
of the incorrect region. The third is either the symbol 'doublon' or the list
-of possible corrections as returned by 'ispell-parse-output'.
+of possible corrections as returned by `ispell-parse-output'.
If any of the functions return non-Nil, the word is not highlighted as
incorrect."
(setq r p)
(goto-char p))))
r)))
-
+
;*---------------------------------------------------------------------*/
;* flyspell-word-search-forward ... */
;*---------------------------------------------------------------------*/
(setq r p)
(goto-char (1+ p)))))
r)))
-
+
;*---------------------------------------------------------------------*/
;* flyspell-word ... */
;*---------------------------------------------------------------------*/
flyspell-mark-duplications-flag
(save-excursion
(goto-char (1- start))
- (let ((p (flyspell-word-search-backward
+ (let ((p (flyspell-word-search-backward
word
(- start (1+ (- end start))))))
(and p (/= p (1- start))))))
(flyspell-notify-misspell start end word poss))
nil))))
;; return to original location
- (goto-char cursor-location)
+ (goto-char cursor-location)
(if ispell-quit (setq ispell-quit nil))
res))))))))
(defun flyspell-auto-correct-previous-hook ()
"Hook to track successive calls to `flyspell-auto-correct-previous-word'.
Sets `flyspell-auto-correct-previous-pos' to nil"
- (interactive)
+ (interactive)
(remove-hook 'pre-command-hook (function flyspell-auto-correct-previous-hook) t)
(unless (eq this-command (function flyspell-auto-correct-previous-word))
(setq flyspell-auto-correct-previous-pos nil)))
;*---------------------------------------------------------------------*/
;* flyspell-auto-correct-previous-word ... */
;*---------------------------------------------------------------------*/
-(defun flyspell-auto-correct-previous-word (position)
+(defun flyspell-auto-correct-previous-word (position)
"*Auto correct the first mispelled word that occurs before point.
But don't look beyond what's visible on the screen."
(interactive "d")
(narrow-to-region top bot)
(overlay-recenter (point))
- (add-hook 'pre-command-hook
+ (add-hook 'pre-command-hook
(function flyspell-auto-correct-previous-hook) t t)
(unless flyspell-auto-correct-previous-pos
;; only reset if a new overlay exists
(setq flyspell-auto-correct-previous-pos nil)
-
+
(let ((overlay-list (overlays-in (point-min) position))
(new-overlay 'dummy-value))
-
+
;; search for previous (new) flyspell overlay
(while (and new-overlay
(or (not (flyspell-overlay-p new-overlay))
;; check if its face has changed
- (not (eq (get-char-property
- (overlay-start new-overlay) 'face)
+ (not (eq (get-char-property
+ (overlay-start new-overlay) 'face)
'flyspell-incorrect))))
(setq new-overlay (car-safe overlay-list))
(setq overlay-list (cdr-safe overlay-list)))
-
+
;; if nothing new exits new-overlay should be nil
(if new-overlay ;; the length of the word may change so go to the start
- (setq flyspell-auto-correct-previous-pos
+ (setq flyspell-auto-correct-previous-pos
(overlay-start new-overlay)))))
(when flyspell-auto-correct-previous-pos
and return t.
The third arg POSS is either the symbol 'doublon' or a list of
-possible corrections as returned by 'ispell-parse-output'.
+possible corrections as returned by `ispell-parse-output'.
-This function is meant to be added to 'flyspell-incorrect-hook'."
+This function is meant to be added to `flyspell-incorrect-hook'."
(when (consp poss)
(catch 'done
(let ((str (buffer-substring beg end))
and return t.
The third arg POSS is either the symbol 'doublon' or a list of
-possible corrections as returned by 'ispell-parse-output'.
+possible corrections as returned by `ispell-parse-output'.
-This function is meant to be added to 'flyspell-incorrect-hook'."
+This function is meant to be added to `flyspell-incorrect-hook'."
(when (consp poss)
(catch 'done
(let ((str (buffer-substring beg end))