]> code.delx.au - gnu-emacs/commitdiff
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
authorAgustín Martín <agustin.martin@hispalinux.es>
Fri, 16 Jan 2009 15:20:49 +0000 (15:20 +0000)
committerAgustín Martín <agustin.martin@hispalinux.es>
Fri, 16 Jan 2009 15:20:49 +0000 (15:20 +0000)
(flyspell-pre-point): Make buffer-local.

lisp/ChangeLog
lisp/textmodes/flyspell.el

index 8f9dece15f0afa7c70d5b29a1005fcb7535241ed..abb083abaafdb7bd5bd316ded3f09ff7719312bd 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-16  Agustín Martín <agustin.martin@hispalinux.es>
+
+       * textmodes/flyspell.el (flyspell-post-command-hook): Do nothing
+       unless flyspell-mode is enabled.
+       (flyspell-pre-point): Make buffer-local.
+
 2009-01-16  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>
 
        * textmodes/bibtex.el (bibtex-format-entry): Fix previous change.
@@ -9,7 +15,7 @@
        constants.
        (bibtex-mode): Doc fix.
 
-       2009-01-16  Agustín Martín <agustin.martin@hispalinux.es>
+2009-01-16  Agustín Martín <agustin.martin@hispalinux.es>
 
        * textmodes/ispell.el: Protect against declare-function undefined
        in xemacs.
index 28340b6e857143566a436cfc17b431bc6ef2aefb..e14ec47c2e086d4446400fcf5d7d3d15aad5028d 100644 (file)
@@ -680,6 +680,7 @@ not the very same deplacement command."
 (defvar flyspell-pre-column     nil)
 (defvar flyspell-pre-pre-buffer nil)
 (defvar flyspell-pre-pre-point  nil)
+(make-variable-buffer-local 'flyspell-pre-point)
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-previous-command ...                                    */
@@ -929,46 +930,47 @@ Mostly we check word delimiters."
 (defun flyspell-post-command-hook ()
   "The `post-command-hook' used by flyspell to check a word in-the-fly."
   (interactive)
-  (let ((command this-command)
-       ;; Prevent anything we do from affecting the mark.
-       deactivate-mark)
-    (if (flyspell-check-pre-word-p)
-       (with-current-buffer flyspell-pre-buffer
-         '(flyspell-debug-signal-pre-word-checked)
-         (save-excursion
-           (goto-char flyspell-pre-point)
-           (flyspell-word))))
-    (if (flyspell-check-word-p)
-       (progn
-         '(flyspell-debug-signal-word-checked)
-         (flyspell-word)
-         ;; we remember which word we have just checked.
-         ;; this will be used next time we will check a word
-         ;; to compare the next current word with the word
-         ;; that as been registered in the pre-command-hook
-         ;; that is these variables are used within the predicate
-         ;; FLYSPELL-CHECK-PRE-WORD-P
-         (setq flyspell-pre-pre-buffer (current-buffer))
-         (setq flyspell-pre-pre-point  (point)))
-      (progn
-       (setq flyspell-pre-pre-buffer nil)
-       (setq flyspell-pre-pre-point  nil)
-       ;; when a word is not checked because of a delayed command
-       ;; we do not disable the ispell cache.
-       (if (and (symbolp this-command) (get this-command 'flyspell-delayed))
-           (progn
-             (setq flyspell-word-cache-end -1)
-             (setq flyspell-word-cache-result '_)))))
-    (while (and (not (input-pending-p)) (consp flyspell-changes))
-      (let ((start (car (car flyspell-changes)))
-           (stop  (cdr (car flyspell-changes))))
-       (if (flyspell-check-changed-word-p start stop)
+  (when flyspell-mode
+    (let ((command this-command)
+         ;; Prevent anything we do from affecting the mark.
+         deactivate-mark)
+      (if (flyspell-check-pre-word-p)
+         (with-current-buffer flyspell-pre-buffer
+           '(flyspell-debug-signal-pre-word-checked)
            (save-excursion
-             '(flyspell-debug-signal-changed-checked)
-             (goto-char start)
-             (flyspell-word)))
-       (setq flyspell-changes (cdr flyspell-changes))))
-    (setq flyspell-previous-command command)))
+             (goto-char flyspell-pre-point)
+             (flyspell-word))))
+      (if (flyspell-check-word-p)
+         (progn
+           '(flyspell-debug-signal-word-checked)
+           (flyspell-word)
+           ;; we remember which word we have just checked.
+           ;; this will be used next time we will check a word
+           ;; to compare the next current word with the word
+           ;; that as been registered in the pre-command-hook
+           ;; that is these variables are used within the predicate
+           ;; FLYSPELL-CHECK-PRE-WORD-P
+           (setq flyspell-pre-pre-buffer (current-buffer))
+           (setq flyspell-pre-pre-point  (point)))
+       (progn
+         (setq flyspell-pre-pre-buffer nil)
+         (setq flyspell-pre-pre-point  nil)
+         ;; when a word is not checked because of a delayed command
+         ;; we do not disable the ispell cache.
+         (if (and (symbolp this-command) (get this-command 'flyspell-delayed))
+             (progn
+               (setq flyspell-word-cache-end -1)
+               (setq flyspell-word-cache-result '_)))))
+      (while (and (not (input-pending-p)) (consp flyspell-changes))
+       (let ((start (car (car flyspell-changes)))
+             (stop  (cdr (car flyspell-changes))))
+         (if (flyspell-check-changed-word-p start stop)
+             (save-excursion
+               '(flyspell-debug-signal-changed-checked)
+               (goto-char start)
+               (flyspell-word)))
+         (setq flyspell-changes (cdr flyspell-changes))))
+      (setq flyspell-previous-command command))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-notify-misspell ...                                     */