diff options
| author | Stefan Monnier | 2011-10-11 22:48:40 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-10-11 22:48:40 -0400 |
| commit | e1b0b23a7d46f4eacb8f8ed9d540742cb61eeb7b (patch) | |
| tree | c3af41b07e2e2078aafeaefea2644147cf2f1b19 | |
| parent | a120bde92351b1c97aa0c000d48e31eb888c9078 (diff) | |
| download | emacs-e1b0b23a7d46f4eacb8f8ed9d540742cb61eeb7b.tar.gz emacs-e1b0b23a7d46f4eacb8f8ed9d540742cb61eeb7b.zip | |
* lisp/textmodes/flyspell.el (flyspell-word): Move with-local-quit from here...
(flyspell-post-command-hook): ...to here.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/textmodes/flyspell.el | 97 |
2 files changed, 54 insertions, 49 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a4cb9dfd5de..58a038676e7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-10-12 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * textmodes/flyspell.el (flyspell-word): Move with-local-quit | ||
| 4 | from here... | ||
| 5 | (flyspell-post-command-hook): ...to here. | ||
| 6 | |||
| 1 | 2011-10-11 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2011-10-11 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * mail/sendmail.el (send-mail-function): Don't use sendmail-query-once | 9 | * mail/sendmail.el (send-mail-function): Don't use sendmail-query-once |
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 4eb4efc3766..c2af3f7be84 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -931,49 +931,52 @@ Mostly we check word delimiters." | |||
| 931 | ;;* previous word nor the current word */ | 931 | ;;* previous word nor the current word */ |
| 932 | ;;*---------------------------------------------------------------------*/ | 932 | ;;*---------------------------------------------------------------------*/ |
| 933 | (defun flyspell-post-command-hook () | 933 | (defun flyspell-post-command-hook () |
| 934 | "The `post-command-hook' used by flyspell to check a word in-the-fly." | 934 | "The `post-command-hook' used by flyspell to check a word on-the-fly." |
| 935 | (interactive) | 935 | (interactive) |
| 936 | (when flyspell-mode | 936 | (when flyspell-mode |
| 937 | (let ((command this-command) | 937 | (with-local-quit |
| 938 | ;; Prevent anything we do from affecting the mark. | 938 | (let ((command this-command) |
| 939 | deactivate-mark) | 939 | ;; Prevent anything we do from affecting the mark. |
| 940 | (if (flyspell-check-pre-word-p) | 940 | deactivate-mark) |
| 941 | (with-current-buffer flyspell-pre-buffer | 941 | (if (flyspell-check-pre-word-p) |
| 942 | '(flyspell-debug-signal-pre-word-checked) | 942 | (with-current-buffer flyspell-pre-buffer |
| 943 | (save-excursion | 943 | '(flyspell-debug-signal-pre-word-checked) |
| 944 | (goto-char flyspell-pre-point) | 944 | (save-excursion |
| 945 | (flyspell-word)))) | 945 | (goto-char flyspell-pre-point) |
| 946 | (if (flyspell-check-word-p) | 946 | (flyspell-word)))) |
| 947 | (progn | 947 | (if (flyspell-check-word-p) |
| 948 | '(flyspell-debug-signal-word-checked) | 948 | (progn |
| 949 | (flyspell-word) | 949 | '(flyspell-debug-signal-word-checked) |
| 950 | ;; we remember which word we have just checked. | 950 | ;; FIXME: This should be asynchronous! |
| 951 | ;; this will be used next time we will check a word | 951 | (flyspell-word) |
| 952 | ;; to compare the next current word with the word | 952 | ;; we remember which word we have just checked. |
| 953 | ;; that as been registered in the pre-command-hook | 953 | ;; this will be used next time we will check a word |
| 954 | ;; that is these variables are used within the predicate | 954 | ;; to compare the next current word with the word |
| 955 | ;; FLYSPELL-CHECK-PRE-WORD-P | 955 | ;; that as been registered in the pre-command-hook |
| 956 | (setq flyspell-pre-pre-buffer (current-buffer)) | 956 | ;; that is these variables are used within the predicate |
| 957 | (setq flyspell-pre-pre-point (point))) | 957 | ;; FLYSPELL-CHECK-PRE-WORD-P |
| 958 | (progn | 958 | (setq flyspell-pre-pre-buffer (current-buffer)) |
| 959 | (setq flyspell-pre-pre-buffer nil) | 959 | (setq flyspell-pre-pre-point (point))) |
| 960 | (setq flyspell-pre-pre-point nil) | 960 | (progn |
| 961 | ;; when a word is not checked because of a delayed command | 961 | (setq flyspell-pre-pre-buffer nil) |
| 962 | ;; we do not disable the ispell cache. | 962 | (setq flyspell-pre-pre-point nil) |
| 963 | (if (and (symbolp this-command) (get this-command 'flyspell-delayed)) | 963 | ;; when a word is not checked because of a delayed command |
| 964 | (progn | 964 | ;; we do not disable the ispell cache. |
| 965 | (setq flyspell-word-cache-end -1) | 965 | (if (and (symbolp this-command) |
| 966 | (setq flyspell-word-cache-result '_))))) | 966 | (get this-command 'flyspell-delayed)) |
| 967 | (while (and (not (input-pending-p)) (consp flyspell-changes)) | 967 | (progn |
| 968 | (let ((start (car (car flyspell-changes))) | 968 | (setq flyspell-word-cache-end -1) |
| 969 | (stop (cdr (car flyspell-changes)))) | 969 | (setq flyspell-word-cache-result '_))))) |
| 970 | (if (flyspell-check-changed-word-p start stop) | 970 | (while (and (not (input-pending-p)) (consp flyspell-changes)) |
| 971 | (save-excursion | 971 | (let ((start (car (car flyspell-changes))) |
| 972 | '(flyspell-debug-signal-changed-checked) | 972 | (stop (cdr (car flyspell-changes)))) |
| 973 | (goto-char start) | 973 | (if (flyspell-check-changed-word-p start stop) |
| 974 | (flyspell-word))) | 974 | (save-excursion |
| 975 | (setq flyspell-changes (cdr flyspell-changes)))) | 975 | '(flyspell-debug-signal-changed-checked) |
| 976 | (setq flyspell-previous-command command)))) | 976 | (goto-char start) |
| 977 | (flyspell-word))) | ||
| 978 | (setq flyspell-changes (cdr flyspell-changes)))) | ||
| 979 | (setq flyspell-previous-command command))))) | ||
| 977 | 980 | ||
| 978 | ;;*---------------------------------------------------------------------*/ | 981 | ;;*---------------------------------------------------------------------*/ |
| 979 | ;;* flyspell-notify-misspell ... */ | 982 | ;;* flyspell-notify-misspell ... */ |
| @@ -1100,14 +1103,10 @@ misspelling and skips redundant spell-checking step." | |||
| 1100 | ;; we mark the ispell process so it can be killed | 1103 | ;; we mark the ispell process so it can be killed |
| 1101 | ;; when emacs is exited without query | 1104 | ;; when emacs is exited without query |
| 1102 | (set-process-query-on-exit-flag ispell-process nil) | 1105 | (set-process-query-on-exit-flag ispell-process nil) |
| 1103 | ;; Wait until ispell has processed word. Since this | 1106 | ;; Wait until ispell has processed word. |
| 1104 | ;; code is often executed from post-command-hook but | 1107 | (while (progn |
| 1105 | ;; the ispell process may not be responsive, it's | 1108 | (accept-process-output ispell-process) |
| 1106 | ;; important to make sure we re-enable C-g. | 1109 | (not (string= "" (car ispell-filter))))) |
| 1107 | (with-local-quit | ||
| 1108 | (while (progn | ||
| 1109 | (accept-process-output ispell-process) | ||
| 1110 | (not (string= "" (car ispell-filter)))))) | ||
| 1111 | ;; (ispell-send-string "!\n") | 1110 | ;; (ispell-send-string "!\n") |
| 1112 | ;; back to terse mode. | 1111 | ;; back to terse mode. |
| 1113 | ;; Remove leading empty element | 1112 | ;; Remove leading empty element |