early aid that relieves you from moving the buffer or reaching for the
mouse to consult an error message.
+** Flyspell
+
+*** New user option 'flyspell-check-changes'.
+It checks only edited text.
+
** JS mode.
The binding 'M-.' has been removed from the major mode keymaps in
'js-mode' and 'js-ts-mode', having it default to the global binding
"The key binding for flyspell auto correction."
:type 'key-sequence)
+(defcustom flyspell-check-changes nil
+ "Check only on moving point from the edited word.
+Unlike the default behavior, don't check when moving point without editing."
+ :type 'boolean
+ :version "30.1")
+
;;*---------------------------------------------------------------------*/
;;* Mode specific options */
;;* ------------------------------------------------------------- */
(flyspell-accept-buffer-local-defs 'force)
(flyspell-delay-commands)
(flyspell-deplacement-commands)
- (add-hook 'post-command-hook (function flyspell-post-command-hook) t t)
+ (if flyspell-check-changes
+ (add-hook 'post-command-hook (function flyspell-check-changes) t t)
+ (add-hook 'post-command-hook (function flyspell-post-command-hook) t t))
(add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
(add-hook 'after-change-functions 'flyspell-after-change-function nil t)
(add-hook 'hack-local-variables-hook
;;;###autoload
(defun flyspell--mode-off ()
"Turn Flyspell mode off."
+ (remove-hook 'post-command-hook (function flyspell-check-changes) t)
(remove-hook 'post-command-hook (function flyspell-post-command-hook) t)
(remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t)
(remove-hook 'after-change-functions 'flyspell-after-change-function t)
(setq flyspell-changes (cdr flyspell-changes))))
(setq flyspell-previous-command command)))))
+(defun flyspell-check-changes ()
+ "The `post-command-hook' used by flyspell to check only edits.
+It checks only on moving point from the edited word,
+not when moving point without editing."
+ (when flyspell-mode
+ (with-local-quit
+ (when (consp flyspell-changes)
+ (let ((start (car (car flyspell-changes)))
+ (stop (cdr (car flyspell-changes)))
+ (word (save-excursion (flyspell-get-word))))
+ (unless (and word (<= (nth 1 word) start) (>= (nth 2 word) stop))
+ (save-excursion
+ (goto-char start)
+ (flyspell-word))
+ (setq flyspell-changes nil)))))))
+
;;*---------------------------------------------------------------------*/
;;* flyspell-notify-misspell ... */
;;*---------------------------------------------------------------------*/