(let ((pos (point)))
(or (>= pos start) (<= pos stop) (= pos (1+ stop))))))))
+(defcustom flyspell-blocking-delay nil
+ "Whether to block Emacs while Flyspell waits after a delayed command."
+ :type 'boolean
+ :version "30.1")
+
+(defvar flyspell--timer nil)
+
;;*---------------------------------------------------------------------*/
;;* flyspell-check-word-p ... */
;;*---------------------------------------------------------------------*/
;; The current command is not delayed, that
;; is that we must check the word now.
(and (not unread-command-events)
- (sit-for flyspell-delay)))
+ (if flyspell-blocking-delay
+ (sit-for flyspell-delay)
+ (setq flyspell--timer
+ (run-with-idle-timer
+ flyspell-delay nil
+ (lambda (buffer)
+ (when (eq (current-buffer) buffer) (flyspell-word)))
+ (current-buffer)))
+ nil)))
(t t)))
(t t))))
(defun flyspell-post-command-hook ()
"The `post-command-hook' used by flyspell to check a word on-the-fly."
(interactive)
+ (when (timerp flyspell--timer) (cl-callf cancel-timer flyspell--timer))
(when flyspell-mode
(with-local-quit
(let ((command this-command)
(set-process-query-on-exit-flag ispell-process nil)
;; Wait until ispell has processed word.
(while (progn
- (accept-process-output ispell-process)
+ (accept-process-output ispell-process 1)
(not (string= "" (car ispell-filter)))))
;; (ispell-send-string "!\n")
;; back to terse mode.