Mercurial > emacs
changeset 101239:059475cb166b
(flyspell-post-command-hook): Do nothing unless flyspell-mode is enabled.
(flyspell-pre-point): Make buffer-local.
author | Agustin Martin <agustin.martin@hispalinux.es> |
---|---|
date | Fri, 16 Jan 2009 15:20:49 +0000 |
parents | 00558b6e5d57 |
children | b8ae7a4c9154 |
files | lisp/ChangeLog lisp/textmodes/flyspell.el |
diffstat | 2 files changed, 48 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Jan 16 15:11:50 2009 +0000 +++ b/lisp/ChangeLog Fri Jan 16 15:20:49 2009 +0000 @@ -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.
--- a/lisp/textmodes/flyspell.el Fri Jan 16 15:11:50 2009 +0000 +++ b/lisp/textmodes/flyspell.el Fri Jan 16 15:20:49 2009 +0000 @@ -680,6 +680,7 @@ (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 @@ (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) + (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 + (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 - '(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))) + (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 ... */