emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/flyspell.el
Date: Mon, 28 Nov 2005 11:44:39 -0500

Index: emacs/lisp/textmodes/flyspell.el
diff -c emacs/lisp/textmodes/flyspell.el:1.88 
emacs/lisp/textmodes/flyspell.el:1.89
*** emacs/lisp/textmodes/flyspell.el:1.88       Wed Nov 16 17:00:29 2005
--- emacs/lisp/textmodes/flyspell.el    Mon Nov 28 16:44:37 2005
***************
*** 501,523 ****
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-accept-buffer-local-defs ...                            */
  ;;*---------------------------------------------------------------------*/
  (defun flyspell-accept-buffer-local-defs ()
!   ;; strange problem.  If buffer in current window has font-lock turned on,
!   ;; but SET-BUFFER was called to point to an invisible buffer, this ispell
!   ;; call will reset the buffer to the buffer in the current window.  However,
!   ;; it only happens at startup (fix by Albert L. Ting).
!   (save-current-buffer
!     (ispell-accept-buffer-local-defs))
!   (if (not (and (eq flyspell-dash-dictionary ispell-dictionary)
!               (eq flyspell-dash-local-dictionary ispell-local-dictionary)))
        ;; The dictionary has changed
!       (progn
!       (setq flyspell-dash-dictionary ispell-dictionary)
!       (setq flyspell-dash-local-dictionary ispell-local-dictionary)
!       (if (member (or ispell-local-dictionary ispell-dictionary)
!                   flyspell-dictionaries-that-consider-dash-as-word-delimiter)
!           (setq flyspell-consider-dash-as-word-delimiter-flag t)
!         (setq flyspell-consider-dash-as-word-delimiter-flag nil)))))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-mode-on ...                                             */
--- 501,529 ----
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-accept-buffer-local-defs ...                            */
  ;;*---------------------------------------------------------------------*/
+ (defvar flyspell-last-buffer nil
+   "The buffer in which the last flyspell operation took place.")
+ 
  (defun flyspell-accept-buffer-local-defs ()
!   ;; When flyspell-word is used inside a loop (e.g. when processing
!   ;; flyspell-changes), the calls to `ispell-accept-buffer-local-defs' end
!   ;; up dwarfing everything else, so only do it when the buffer has changed.
!   (unless (eq flyspell-last-buffer (current-buffer))
!     (setq flyspell-last-buffer (current-buffer))
!     ;; Strange problem:  If buffer in current window has font-lock turned on,
!     ;; but SET-BUFFER was called to point to an invisible buffer, this ispell
!     ;; call will reset the buffer to the buffer in the current window.
!     ;; However, it only happens at startup (fix by Albert L. Ting).
!     (save-current-buffer
!       (ispell-accept-buffer-local-defs))
!     (unless (and (eq flyspell-dash-dictionary ispell-dictionary)
!                  (eq flyspell-dash-local-dictionary ispell-local-dictionary))
        ;; The dictionary has changed
!       (setq flyspell-dash-dictionary ispell-dictionary)
!       (setq flyspell-dash-local-dictionary ispell-local-dictionary)
!       (setq flyspell-consider-dash-as-word-delimiter-flag
!             (member (or ispell-local-dictionary ispell-dictionary)
!                     
flyspell-dictionaries-that-consider-dash-as-word-delimiter)))))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-mode-on ...                                             */
***************
*** 543,551 ****
    ;; we bound flyspell action to pre-command hook
    (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
    ;; we bound flyspell action to after-change hook
!   (make-local-variable 'after-change-functions)
!   (setq after-change-functions
!       (cons 'flyspell-after-change-function after-change-functions))
    ;; set flyspell-generic-check-word-p based on the major mode
    (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
      (if mode-predicate
--- 549,555 ----
    ;; we bound flyspell action to pre-command hook
    (add-hook 'pre-command-hook (function flyspell-pre-command-hook) t t)
    ;; we bound flyspell action to after-change hook
!   (add-hook 'after-change-functions 'flyspell-after-change-function nil t)
    ;; set flyspell-generic-check-word-p based on the major mode
    (let ((mode-predicate (get major-mode 'flyspell-mode-predicate)))
      (if mode-predicate
***************
*** 650,657 ****
    ;; we remove the hooks
    (remove-hook 'post-command-hook (function flyspell-post-command-hook) t)
    (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t)
!   (setq after-change-functions (delq 'flyspell-after-change-function
!                                    after-change-functions))
    ;; we remove all the flyspell hilightings
    (flyspell-delete-all-overlays)
    ;; we have to erase pre cache variables
--- 654,660 ----
    ;; we remove the hooks
    (remove-hook 'post-command-hook (function flyspell-post-command-hook) t)
    (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t)
!   (remove-hook 'after-change-functions 'flyspell-after-change-function t)
    ;; we remove all the flyspell hilightings
    (flyspell-delete-all-overlays)
    ;; we have to erase pre cache variables
***************
*** 704,717 ****
  ;;*    position has to be spell checked.                                */
  ;;*---------------------------------------------------------------------*/
  (defvar flyspell-changes nil)
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-after-change-function ...                               */
  ;;*---------------------------------------------------------------------*/
  (defun flyspell-after-change-function (start stop len)
    "Save the current buffer and point for Flyspell's post-command hook."
!   (interactive)
!   (setq flyspell-changes (cons (cons start stop) flyspell-changes)))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-check-changed-word-p ...                                */
--- 707,720 ----
  ;;*    position has to be spell checked.                                */
  ;;*---------------------------------------------------------------------*/
  (defvar flyspell-changes nil)
+ (make-variable-buffer-local 'flyspell-changes)
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-after-change-function ...                               */
  ;;*---------------------------------------------------------------------*/
  (defun flyspell-after-change-function (start stop len)
    "Save the current buffer and point for Flyspell's post-command hook."
!   (push (cons start stop) flyspell-changes))
  
  ;;*---------------------------------------------------------------------*/
  ;;*    flyspell-check-changed-word-p ...                                */
***************
*** 899,905 ****
            (progn
              (setq flyspell-word-cache-end -1)
              (setq flyspell-word-cache-result '_)))))
!     (while (consp flyspell-changes)
        (let ((start (car (car flyspell-changes)))
            (stop  (cdr (car flyspell-changes))))
        (if (flyspell-check-changed-word-p start stop)
--- 902,908 ----
            (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)
***************
*** 1011,1017 ****
            ;; when emacs is exited without query
            (set-process-query-on-exit-flag ispell-process nil)
            ;; Wait until ispell has processed word.  Since this code is often
!             ;; executed rom post-command-hook but the ispell process may not
              ;; be responsive, it's important to make sure we re-enable C-g.
            (with-local-quit
              (while (progn
--- 1014,1020 ----
            ;; when emacs is exited without query
            (set-process-query-on-exit-flag ispell-process nil)
            ;; Wait until ispell has processed word.  Since this code is often
!             ;; executed from post-command-hook but the ispell process may not
              ;; be responsive, it's important to make sure we re-enable C-g.
            (with-local-quit
              (while (progn




reply via email to

[Prev in Thread] Current Thread [Next in Thread]