comparison lisp/textmodes/flyspell.el @ 94303:e0b01f455de0

* ispell.el (ispell-set-spellchecker-params): New function to make sure right params and dictionary alists are used after spellchecker changes. (ispell-aspell-dictionary-alist, ispell-last-program-name) (ispell-initialize-spellchecker-hook): New variables and hook. (ispell-find-aspell-dictionaries): Use ispell-aspell-dictionary-alist. (ispell-maybe-find-aspell-dictionaries): Remove. Calls replaced by (ispell-set-spellchecker-params) calls. (ispell-have-aspell-dictionaries): Remove. * flyspell.el: Replace ispell-maybe-find-aspell-dictionaries by ispell-set-spellchecker-params.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 23 Apr 2008 20:39:10 +0000
parents 7aae3fb72148
children 9e177181ff37
comparison
equal deleted inserted replaced
94302:5a4d9f3d23f9 94303:e0b01f455de0
577 ;;*---------------------------------------------------------------------*/ 577 ;;*---------------------------------------------------------------------*/
578 ;;* flyspell-mode-on ... */ 578 ;;* flyspell-mode-on ... */
579 ;;*---------------------------------------------------------------------*/ 579 ;;*---------------------------------------------------------------------*/
580 (defun flyspell-mode-on () 580 (defun flyspell-mode-on ()
581 "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead." 581 "Turn Flyspell mode on. Do not use this; use `flyspell-mode' instead."
582 (ispell-maybe-find-aspell-dictionaries) 582 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists
583 (setq ispell-highlight-face 'flyspell-incorrect) 583 (setq ispell-highlight-face 'flyspell-incorrect)
584 ;; local dictionaries setup 584 ;; local dictionaries setup
585 (or ispell-local-dictionary ispell-dictionary 585 (or ispell-local-dictionary ispell-dictionary
586 (if flyspell-default-dictionary 586 (if flyspell-default-dictionary
587 (ispell-change-dictionary flyspell-default-dictionary))) 587 (ispell-change-dictionary flyspell-default-dictionary)))
1015 ;;* flyspell-word ... */ 1015 ;;* flyspell-word ... */
1016 ;;*---------------------------------------------------------------------*/ 1016 ;;*---------------------------------------------------------------------*/
1017 (defun flyspell-word (&optional following) 1017 (defun flyspell-word (&optional following)
1018 "Spell check a word." 1018 "Spell check a word."
1019 (interactive (list ispell-following-word)) 1019 (interactive (list ispell-following-word))
1020 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists
1020 (save-excursion 1021 (save-excursion
1021 ;; use the correct dictionary 1022 ;; use the correct dictionary
1022 (flyspell-accept-buffer-local-defs) 1023 (flyspell-accept-buffer-local-defs)
1023 (let* ((cursor-location (point)) 1024 (let* ((cursor-location (point))
1024 (flyspell-word (flyspell-get-word following)) 1025 (flyspell-word (flyspell-get-word following))
1530 (set-buffer buffer) 1531 (set-buffer buffer)
1531 (erase-buffer) 1532 (erase-buffer)
1532 ;; this is done, we can start checking... 1533 ;; this is done, we can start checking...
1533 (if flyspell-issue-message-flag (message "Checking region...")) 1534 (if flyspell-issue-message-flag (message "Checking region..."))
1534 (set-buffer curbuf) 1535 (set-buffer curbuf)
1535 (ispell-check-version) 1536 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists
1536 ;; Local dictionary becomes the global dictionary in use. 1537 ;; Local dictionary becomes the global dictionary in use.
1537 (setq ispell-current-dictionary 1538 (setq ispell-current-dictionary
1538 (or ispell-local-dictionary ispell-dictionary)) 1539 (or ispell-local-dictionary ispell-dictionary))
1539 (setq ispell-current-personal-dictionary 1540 (setq ispell-current-personal-dictionary
1540 (or ispell-local-pdict ispell-personal-dictionary)) 1541 (or ispell-local-pdict ispell-personal-dictionary))
1589 ;;*---------------------------------------------------------------------*/ 1590 ;;*---------------------------------------------------------------------*/
1590 ;;;###autoload 1591 ;;;###autoload
1591 (defun flyspell-region (beg end) 1592 (defun flyspell-region (beg end)
1592 "Flyspell text between BEG and END." 1593 "Flyspell text between BEG and END."
1593 (interactive "r") 1594 (interactive "r")
1595 (ispell-set-spellchecker-params) ; Initialize variables and dicts alists
1594 (if (= beg end) 1596 (if (= beg end)
1595 () 1597 ()
1596 (save-excursion 1598 (save-excursion
1597 (if (> beg end) 1599 (if (> beg end)
1598 (let ((old beg)) 1600 (let ((old beg))