Index: lisp/textmodes/flyspell.el =================================================================== RCS file: /sources/emacs/emacs/lisp/textmodes/flyspell.el,v retrieving revision 1.112 diff -c -r1.112 flyspell.el *** lisp/textmodes/flyspell.el 11 Nov 2006 01:00:03 -0000 1.112 --- lisp/textmodes/flyspell.el 6 Dec 2006 17:34:41 -0000 *************** *** 541,546 **** --- 541,551 ---- (member (or ispell-local-dictionary ispell-dictionary) flyspell-dictionaries-that-consider-dash-as-word-delimiter))))) + (defun flyspell-hack-local-variables-hook () + ;; When local variables are loaded, see if the dictionary context + ;; has changed. + (flyspell-accept-buffer-local-defs 'force)) + (defun flyspell-kill-ispell-hook () (setq flyspell-last-buffer nil) (dolist (buf (buffer-list)) *************** *** 579,584 **** --- 584,592 ---- (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) + ;; we bound flyspell action to hack-local-variables-hook + (add-hook 'hack-local-variables-hook + (function flyspell-hack-local-variables-hook) t t) ;; set flyspell-generic-check-word-predicate based on the major mode (let ((mode-predicate (get major-mode 'flyspell-mode-predicate))) (if mode-predicate *************** *** 684,689 **** --- 692,699 ---- (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) + (remove-hook 'hack-local-variables-hook + (function flyspell-hack-local-variables-hook) t) ;; we remove all the flyspell hilightings (flyspell-delete-all-overlays) ;; we have to erase pre cache variables Index: lisp/textmodes/../ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.10400 diff -c -0 -r1.10400 ChangeLog *** lisp/textmodes/../ChangeLog 4 Dec 2006 10:24:04 -0000 1.10400 --- lisp/textmodes/../ChangeLog 6 Dec 2006 17:35:03 -0000 *************** *** 0 **** --- 1,7 ---- + 2006-12-06 Michaël Cadilhac + + * textmodes/flyspell.el (flyspell-hack-local-variables-hook): New. + Force buffer local defs evaluation on local variables loading. + (flyspell-mode-on, flyspell-mode-off): Use it in + `hack-local-variables-hook'. +