diff options
| author | Agustín Martín | 2009-01-16 15:20:49 +0000 |
|---|---|---|
| committer | Agustín Martín | 2009-01-16 15:20:49 +0000 |
| commit | ca0ebeccbbcbaa1877f8ca8cf131598f013e4f0a (patch) | |
| tree | e30db21bdff7154016515924655a149e7a6c4f61 /lisp/textmodes | |
| parent | 57c48b9da09207dfe1c13e913cfe47f8951fa1ff (diff) | |
| download | emacs-ca0ebeccbbcbaa1877f8ca8cf131598f013e4f0a.tar.gz emacs-ca0ebeccbbcbaa1877f8ca8cf131598f013e4f0a.zip | |
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
(flyspell-pre-point): Make buffer-local.
Diffstat (limited to 'lisp/textmodes')
| -rw-r--r-- | lisp/textmodes/flyspell.el | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 28340b6e857..e14ec47c2e0 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el | |||
| @@ -680,6 +680,7 @@ not the very same deplacement command." | |||
| 680 | (defvar flyspell-pre-column nil) | 680 | (defvar flyspell-pre-column nil) |
| 681 | (defvar flyspell-pre-pre-buffer nil) | 681 | (defvar flyspell-pre-pre-buffer nil) |
| 682 | (defvar flyspell-pre-pre-point nil) | 682 | (defvar flyspell-pre-pre-point nil) |
| 683 | (make-variable-buffer-local 'flyspell-pre-point) | ||
| 683 | 684 | ||
| 684 | ;;*---------------------------------------------------------------------*/ | 685 | ;;*---------------------------------------------------------------------*/ |
| 685 | ;;* flyspell-previous-command ... */ | 686 | ;;* flyspell-previous-command ... */ |
| @@ -929,46 +930,47 @@ Mostly we check word delimiters." | |||
| 929 | (defun flyspell-post-command-hook () | 930 | (defun flyspell-post-command-hook () |
| 930 | "The `post-command-hook' used by flyspell to check a word in-the-fly." | 931 | "The `post-command-hook' used by flyspell to check a word in-the-fly." |
| 931 | (interactive) | 932 | (interactive) |
| 932 | (let ((command this-command) | 933 | (when flyspell-mode |
| 933 | ;; Prevent anything we do from affecting the mark. | 934 | (let ((command this-command) |
| 934 | deactivate-mark) | 935 | ;; Prevent anything we do from affecting the mark. |
| 935 | (if (flyspell-check-pre-word-p) | 936 | deactivate-mark) |
| 936 | (with-current-buffer flyspell-pre-buffer | 937 | (if (flyspell-check-pre-word-p) |
| 937 | '(flyspell-debug-signal-pre-word-checked) | 938 | (with-current-buffer flyspell-pre-buffer |
| 938 | (save-excursion | 939 | '(flyspell-debug-signal-pre-word-checked) |
| 939 | (goto-char flyspell-pre-point) | ||
| 940 | (flyspell-word)))) | ||
| 941 | (if (flyspell-check-word-p) | ||
| 942 | (progn | ||
| 943 | '(flyspell-debug-signal-word-checked) | ||
| 944 | (flyspell-word) | ||
| 945 | ;; we remember which word we have just checked. | ||
| 946 | ;; this will be used next time we will check a word | ||
| 947 | ;; to compare the next current word with the word | ||
| 948 | ;; that as been registered in the pre-command-hook | ||
| 949 | ;; that is these variables are used within the predicate | ||
| 950 | ;; FLYSPELL-CHECK-PRE-WORD-P | ||
| 951 | (setq flyspell-pre-pre-buffer (current-buffer)) | ||
| 952 | (setq flyspell-pre-pre-point (point))) | ||
| 953 | (progn | ||
| 954 | (setq flyspell-pre-pre-buffer nil) | ||
| 955 | (setq flyspell-pre-pre-point nil) | ||
| 956 | ;; when a word is not checked because of a delayed command | ||
| 957 | ;; we do not disable the ispell cache. | ||
| 958 | (if (and (symbolp this-command) (get this-command 'flyspell-delayed)) | ||
| 959 | (progn | ||
| 960 | (setq flyspell-word-cache-end -1) | ||
| 961 | (setq flyspell-word-cache-result '_))))) | ||
| 962 | (while (and (not (input-pending-p)) (consp flyspell-changes)) | ||
| 963 | (let ((start (car (car flyspell-changes))) | ||
| 964 | (stop (cdr (car flyspell-changes)))) | ||
| 965 | (if (flyspell-check-changed-word-p start stop) | ||
| 966 | (save-excursion | 940 | (save-excursion |
| 967 | '(flyspell-debug-signal-changed-checked) | 941 | (goto-char flyspell-pre-point) |
| 968 | (goto-char start) | 942 | (flyspell-word)))) |
| 969 | (flyspell-word))) | 943 | (if (flyspell-check-word-p) |
| 970 | (setq flyspell-changes (cdr flyspell-changes)))) | 944 | (progn |
| 971 | (setq flyspell-previous-command command))) | 945 | '(flyspell-debug-signal-word-checked) |
| 946 | (flyspell-word) | ||
| 947 | ;; we remember which word we have just checked. | ||
| 948 | ;; this will be used next time we will check a word | ||
| 949 | ;; to compare the next current word with the word | ||
| 950 | ;; that as been registered in the pre-command-hook | ||
| 951 | ;; that is these variables are used within the predicate | ||
| 952 | ;; FLYSPELL-CHECK-PRE-WORD-P | ||
| 953 | (setq flyspell-pre-pre-buffer (current-buffer)) | ||
| 954 | (setq flyspell-pre-pre-point (point))) | ||
| 955 | (progn | ||
| 956 | (setq flyspell-pre-pre-buffer nil) | ||
| 957 | (setq flyspell-pre-pre-point nil) | ||
| 958 | ;; when a word is not checked because of a delayed command | ||
| 959 | ;; we do not disable the ispell cache. | ||
| 960 | (if (and (symbolp this-command) (get this-command 'flyspell-delayed)) | ||
| 961 | (progn | ||
| 962 | (setq flyspell-word-cache-end -1) | ||
| 963 | (setq flyspell-word-cache-result '_))))) | ||
| 964 | (while (and (not (input-pending-p)) (consp flyspell-changes)) | ||
| 965 | (let ((start (car (car flyspell-changes))) | ||
| 966 | (stop (cdr (car flyspell-changes)))) | ||
| 967 | (if (flyspell-check-changed-word-p start stop) | ||
| 968 | (save-excursion | ||
| 969 | '(flyspell-debug-signal-changed-checked) | ||
| 970 | (goto-char start) | ||
| 971 | (flyspell-word))) | ||
| 972 | (setq flyspell-changes (cdr flyspell-changes)))) | ||
| 973 | (setq flyspell-previous-command command)))) | ||
| 972 | 974 | ||
| 973 | ;;*---------------------------------------------------------------------*/ | 975 | ;;*---------------------------------------------------------------------*/ |
| 974 | ;;* flyspell-notify-misspell ... */ | 976 | ;;* flyspell-notify-misspell ... */ |