diff options
| author | Eli Zaretskii | 2006-05-05 12:34:51 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2006-05-05 12:34:51 +0000 |
| commit | 87a6b92cf55b34d838c17c6b0c3092a5ff3aa59e (patch) | |
| tree | 16a417e37c0147855836a6625a294cdd80c69325 | |
| parent | e98a14ffeb69fbbca82050368edcea2fa0be4f58 (diff) | |
| download | emacs-87a6b92cf55b34d838c17c6b0c3092a5ff3aa59e.tar.gz emacs-87a6b92cf55b34d838c17c6b0c3092a5ff3aa59e.zip | |
(ispell-buffer-local-dict): Add a `no-reload' argument to avoid the call to
`ispell-internal-change-dictionary' when not needed.
(ispell-change-dictionary): Use this argument and call
`ispell-internal-change-dictionary' after the possible change to
`ispell-local-dictionary'.
(ispell-internal-change-dictionary): Check for a change in personal dictionary
use too.
Cosmetic changes from Agustín Martín <agustin.martin@hispalinux.es>.
| -rw-r--r-- | lisp/textmodes/ispell.el | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index da77508dce3..fed06a572bb 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -2607,15 +2607,18 @@ By just answering RET you can find out what the current dictionary is." | |||
| 2607 | (mapcar 'list (ispell-valid-dictionary-list))) | 2607 | (mapcar 'list (ispell-valid-dictionary-list))) |
| 2608 | nil t) | 2608 | nil t) |
| 2609 | current-prefix-arg)) | 2609 | current-prefix-arg)) |
| 2610 | (unless arg (ispell-buffer-local-dict)) | 2610 | (unless arg (ispell-buffer-local-dict 'no-reload)) |
| 2611 | (if (equal dict "default") (setq dict nil)) | 2611 | (if (equal dict "default") (setq dict nil)) |
| 2612 | ;; This relies on completing-read's bug of returning "" for no match | 2612 | ;; This relies on completing-read's bug of returning "" for no match |
| 2613 | (cond ((equal dict "") | 2613 | (cond ((equal dict "") |
| 2614 | (ispell-internal-change-dictionary) | ||
| 2614 | (message "Using %s dictionary" | 2615 | (message "Using %s dictionary" |
| 2615 | (or ispell-local-dictionary ispell-dictionary "default"))) | 2616 | (or ispell-local-dictionary ispell-dictionary "default"))) |
| 2616 | ((equal dict (or ispell-local-dictionary | 2617 | ((equal dict (or ispell-local-dictionary |
| 2617 | ispell-dictionary "default")) | 2618 | ispell-dictionary "default")) |
| 2618 | ;; Specified dictionary is the default already. No-op | 2619 | ;; Specified dictionary is the default already. Could reload |
| 2620 | ;; the dictionaries if needed. | ||
| 2621 | (ispell-internal-change-dictionary) | ||
| 2619 | (and (interactive-p) | 2622 | (and (interactive-p) |
| 2620 | (message "No change, using %s dictionary" dict))) | 2623 | (message "No change, using %s dictionary" dict))) |
| 2621 | (t ; reset dictionary! | 2624 | (t ; reset dictionary! |
| @@ -2634,13 +2637,16 @@ By just answering RET you can find out what the current dictionary is." | |||
| 2634 | dict)))) | 2637 | dict)))) |
| 2635 | 2638 | ||
| 2636 | (defun ispell-internal-change-dictionary () | 2639 | (defun ispell-internal-change-dictionary () |
| 2637 | "Update the dictionary actually used by Ispell. | 2640 | "Update the dictionary and the personal dictionary used by Ispell. |
| 2638 | This may kill the Ispell process; if so, | 2641 | This may kill the Ispell process; if so, |
| 2639 | a new one will be started when needed." | 2642 | a new one will be started when needed." |
| 2640 | (let ((dict (or ispell-local-dictionary ispell-dictionary))) | 2643 | (let ((dict (or ispell-local-dictionary ispell-dictionary)) |
| 2641 | (unless (equal ispell-current-dictionary dict) | 2644 | (pdict (or ispell-local-pdict ispell-personal-dictionary))) |
| 2645 | (unless (and (equal ispell-current-dictionary dict) | ||
| 2646 | (equal ispell-current-personal-dictionary pdict)) | ||
| 2642 | (ispell-kill-ispell t) | 2647 | (ispell-kill-ispell t) |
| 2643 | (setq ispell-current-dictionary dict)))) | 2648 | (setq ispell-current-dictionary dict |
| 2649 | ispell-current-personal-dictionary pdict)))) | ||
| 2644 | 2650 | ||
| 2645 | ;;; Spelling of comments are checked when ispell-check-comments is non-nil. | 2651 | ;;; Spelling of comments are checked when ispell-check-comments is non-nil. |
| 2646 | 2652 | ||
| @@ -3667,8 +3673,9 @@ Includes Latex/Nroff modes and extended character mode." | |||
| 3667 | 3673 | ||
| 3668 | ;;; Can kill the current ispell process | 3674 | ;;; Can kill the current ispell process |
| 3669 | 3675 | ||
| 3670 | (defun ispell-buffer-local-dict () | 3676 | (defun ispell-buffer-local-dict (&optional no-reload) |
| 3671 | "Initializes local dictionary and local personal dictionary. | 3677 | "Initializes local dictionary and local personal dictionary. |
| 3678 | If optional NO-RELOAD is non-nil, do not make any dictionary reloading. | ||
| 3672 | When a dictionary is defined in the buffer (see variable | 3679 | When a dictionary is defined in the buffer (see variable |
| 3673 | `ispell-dictionary-keyword'), it will override the local setting | 3680 | `ispell-dictionary-keyword'), it will override the local setting |
| 3674 | from \\[ispell-change-dictionary]. | 3681 | from \\[ispell-change-dictionary]. |
| @@ -3695,12 +3702,9 @@ Both should not be used to define a buffer-local dictionary." | |||
| 3695 | (if (re-search-forward " *\\([^ \"]+\\)" end t) | 3702 | (if (re-search-forward " *\\([^ \"]+\\)" end t) |
| 3696 | (setq ispell-local-pdict | 3703 | (setq ispell-local-pdict |
| 3697 | (match-string-no-properties 1))))))) | 3704 | (match-string-no-properties 1))))))) |
| 3698 | ;; Reload if new personal dictionary defined. | 3705 | (unless no-reload |
| 3699 | (if (not (equal ispell-current-personal-dictionary | 3706 | ;; Reload if new dictionary (maybe the personal one) defined. |
| 3700 | (or ispell-local-pdict ispell-personal-dictionary))) | 3707 | (ispell-internal-change-dictionary))) |
| 3701 | (ispell-kill-ispell t)) | ||
| 3702 | ;; Reload if new dictionary defined. | ||
| 3703 | (ispell-internal-change-dictionary)) | ||
| 3704 | 3708 | ||
| 3705 | 3709 | ||
| 3706 | (defun ispell-buffer-local-words () | 3710 | (defun ispell-buffer-local-words () |