diff options
| author | Richard M. Stallman | 2005-12-16 02:00:02 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-12-16 02:00:02 +0000 |
| commit | 09b2eb5e8c2a529279cdee5d8fb6c554f54d5538 (patch) | |
| tree | ae73420f8ad49e75ad17dccbe86e8e98e0734284 | |
| parent | 078d58e013d7416ce410c2d8555781e34ff44fda (diff) | |
| download | emacs-09b2eb5e8c2a529279cdee5d8fb6c554f54d5538.tar.gz emacs-09b2eb5e8c2a529279cdee5d8fb6c554f54d5538.zip | |
(ispell-current-personal-dictionary): New variable.
(ispell-start-process): Set that variable.
Clear ispell-buffer-local-name.
(ispell-internal-change-dictionary):
Set ispell-current-dictionary after killing process.
(ispell-buffer-local-dict):
Don't set spell-personal-dictionary after killing process.
(ispell-buffer-local-words): Don't clear out ispell-buffer-local-name.
(ispell-tex-skip-alists)
(ispell-html-skip-alists, ispell-skip-region-alist): Mark as risky.
| -rw-r--r-- | lisp/textmodes/ispell.el | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 9e81c224855..42c773240c6 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -1161,6 +1161,10 @@ The variable `ispell-library-directory' defines the library location." | |||
| 1161 | This is passed to the ispell process using the `-d' switch and is | 1161 | This is passed to the ispell process using the `-d' switch and is |
| 1162 | used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.") | 1162 | used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.") |
| 1163 | 1163 | ||
| 1164 | (defvar ispell-current-personal-dictionary nil | ||
| 1165 | "The name of the current personal dictionary, or nil for the default. | ||
| 1166 | This is passed to the ispell process using the `-p' switch.") | ||
| 1167 | |||
| 1164 | (defvar ispell-dictionary nil | 1168 | (defvar ispell-dictionary nil |
| 1165 | "Default dictionary to use if `ispell-local-dictionary' is nil.") | 1169 | "Default dictionary to use if `ispell-local-dictionary' is nil.") |
| 1166 | 1170 | ||
| @@ -1339,7 +1343,7 @@ Valid forms include: | |||
| 1339 | (KEY . REGEXP) - skip to the end of REGEXP. REGEXP may be string or symbol. | 1343 | (KEY . REGEXP) - skip to the end of REGEXP. REGEXP may be string or symbol. |
| 1340 | (KEY REGEXP) - skip to end of REGEXP. REGEXP must be a string. | 1344 | (KEY REGEXP) - skip to end of REGEXP. REGEXP must be a string. |
| 1341 | (KEY FUNCTION ARGS) - FUNCTION called with ARGS returns end of region.") | 1345 | (KEY FUNCTION ARGS) - FUNCTION called with ARGS returns end of region.") |
| 1342 | 1346 | (put 'ispell-skip-region-alist 'risky-local-variable t) | |
| 1343 | 1347 | ||
| 1344 | 1348 | ||
| 1345 | ;;;###autoload | 1349 | ;;;###autoload |
| @@ -1369,6 +1373,7 @@ Second list has key placed inside \\begin{}. | |||
| 1369 | 1373 | ||
| 1370 | Delete or add any regions you want to be automatically selected | 1374 | Delete or add any regions you want to be automatically selected |
| 1371 | for skipping in latex mode.") | 1375 | for skipping in latex mode.") |
| 1376 | (put 'ispell-tex-skip-alist 'risky-local-variable t) | ||
| 1372 | 1377 | ||
| 1373 | 1378 | ||
| 1374 | ;;;###autoload | 1379 | ;;;###autoload |
| @@ -1385,7 +1390,7 @@ for skipping in latex mode.") | |||
| 1385 | Same format as `ispell-skip-region-alist' | 1390 | Same format as `ispell-skip-region-alist' |
| 1386 | Note - substrings of other matches must come last | 1391 | Note - substrings of other matches must come last |
| 1387 | (e.g. \"<[tT][tT]/\" and \"<[^ \\t\\n>]\").") | 1392 | (e.g. \"<[tT][tT]/\" and \"<[^ \\t\\n>]\").") |
| 1388 | 1393 | (put 'ispell-html-skip-alists 'risky-local-variable t) | |
| 1389 | 1394 | ||
| 1390 | (defvar ispell-local-pdict ispell-personal-dictionary | 1395 | (defvar ispell-local-pdict ispell-personal-dictionary |
| 1391 | "A buffer local variable containing the current personal dictionary. | 1396 | "A buffer local variable containing the current personal dictionary. |
| @@ -2456,18 +2461,23 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2456 | ;; Local dictionary becomes the global dictionary in use. | 2461 | ;; Local dictionary becomes the global dictionary in use. |
| 2457 | (setq ispell-current-dictionary | 2462 | (setq ispell-current-dictionary |
| 2458 | (or ispell-local-dictionary ispell-dictionary)) | 2463 | (or ispell-local-dictionary ispell-dictionary)) |
| 2464 | (setq ispell-current-personal-dictionary | ||
| 2465 | (or ispell-local-pdict ispell-personal-dictionary)) | ||
| 2459 | (setq args (ispell-get-ispell-args)) | 2466 | (setq args (ispell-get-ispell-args)) |
| 2460 | (if (and ispell-current-dictionary ; use specified dictionary | 2467 | (if (and ispell-current-dictionary ; use specified dictionary |
| 2461 | (not (member "-d" args))) ; only define if not overridden | 2468 | (not (member "-d" args))) ; only define if not overridden |
| 2462 | (setq args | 2469 | (setq args |
| 2463 | (append (list "-d" ispell-current-dictionary) args))) | 2470 | (append (list "-d" ispell-current-dictionary) args))) |
| 2464 | (if ispell-personal-dictionary ; use specified pers dict | 2471 | (if ispell-current-personal-dictionary ; use specified pers dict |
| 2465 | (setq args | 2472 | (setq args |
| 2466 | (append args | 2473 | (append args |
| 2467 | (list "-p" | 2474 | (list "-p" |
| 2468 | (expand-file-name ispell-personal-dictionary))))) | 2475 | (expand-file-name ispell-current-personal-dictionary))))) |
| 2469 | (setq args (append args ispell-extra-args)) | 2476 | (setq args (append args ispell-extra-args)) |
| 2470 | 2477 | ||
| 2478 | ;; Initially we don't know any buffer's local words. | ||
| 2479 | (setq ispell-buffer-local-name nil) | ||
| 2480 | |||
| 2471 | (if ispell-async-processp | 2481 | (if ispell-async-processp |
| 2472 | (let ((process-connection-type ispell-use-ptys-p)) | 2482 | (let ((process-connection-type ispell-use-ptys-p)) |
| 2473 | (apply 'start-process | 2483 | (apply 'start-process |
| @@ -2619,8 +2629,8 @@ This may kill the Ispell process; if so, | |||
| 2619 | a new one will be started when needed." | 2629 | a new one will be started when needed." |
| 2620 | (let ((dict (or ispell-local-dictionary ispell-dictionary))) | 2630 | (let ((dict (or ispell-local-dictionary ispell-dictionary))) |
| 2621 | (unless (equal ispell-current-dictionary dict) | 2631 | (unless (equal ispell-current-dictionary dict) |
| 2622 | (setq ispell-current-dictionary dict) | 2632 | (ispell-kill-ispell t) |
| 2623 | (ispell-kill-ispell t)))) | 2633 | (setq ispell-current-dictionary dict)))) |
| 2624 | 2634 | ||
| 2625 | 2635 | ||
| 2626 | ;;; Spelling of comments are checked when ispell-check-comments is non-nil. | 2636 | ;;; Spelling of comments are checked when ispell-check-comments is non-nil. |
| @@ -3678,22 +3688,22 @@ Both should not be used to define a buffer-local dictionary." | |||
| 3678 | (setq ispell-local-pdict | 3688 | (setq ispell-local-pdict |
| 3679 | (match-string-no-properties 1))))))) | 3689 | (match-string-no-properties 1))))))) |
| 3680 | ;; Reload if new personal dictionary defined. | 3690 | ;; Reload if new personal dictionary defined. |
| 3681 | (if (and ispell-local-pdict | 3691 | (if (not (equal ispell-current-personal-dictionary |
| 3682 | (not (equal ispell-local-pdict ispell-personal-dictionary))) | 3692 | (or ispell-local-pdict ispell-personal-dictionary))) |
| 3683 | (progn | 3693 | (ispell-kill-ispell t)) |
| 3684 | (ispell-kill-ispell t) | ||
| 3685 | (setq ispell-personal-dictionary ispell-local-pdict))) | ||
| 3686 | ;; Reload if new dictionary defined. | 3694 | ;; Reload if new dictionary defined. |
| 3687 | (ispell-internal-change-dictionary)) | 3695 | (ispell-internal-change-dictionary)) |
| 3688 | 3696 | ||
| 3689 | 3697 | ||
| 3690 | (defun ispell-buffer-local-words () | 3698 | (defun ispell-buffer-local-words () |
| 3691 | "Loads the buffer-local dictionary in the current buffer." | 3699 | "Loads the buffer-local dictionary in the current buffer." |
| 3700 | ;; If there's an existing ispell process that's wrong for this use, | ||
| 3701 | ;; kill it. | ||
| 3692 | (if (and ispell-buffer-local-name | 3702 | (if (and ispell-buffer-local-name |
| 3693 | (not (equal ispell-buffer-local-name (buffer-name)))) | 3703 | (not (equal ispell-buffer-local-name (buffer-name)))) |
| 3694 | (progn | 3704 | (ispell-kill-ispell t)) |
| 3695 | (ispell-kill-ispell t) | 3705 | ;; Actually start a new ispell process, because we need |
| 3696 | (setq ispell-buffer-local-name nil))) | 3706 | ;; to send commands now to specify the local words to it. |
| 3697 | (ispell-init-process) | 3707 | (ispell-init-process) |
| 3698 | (save-excursion | 3708 | (save-excursion |
| 3699 | (goto-char (point-min)) | 3709 | (goto-char (point-min)) |