diff options
| author | Stefan Monnier | 2010-09-04 20:47:29 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-09-04 20:47:29 +0200 |
| commit | 5abf15563a3a176f46ec4bcdc602c716eb9d5737 (patch) | |
| tree | c1c85ba8b4a3d9c676917a8a2d36110f8a85a7f4 | |
| parent | 0be01d2c8655f914e522877defa7b323c8cceb9c (diff) | |
| download | emacs-5abf15563a3a176f46ec4bcdc602c716eb9d5737.tar.gz emacs-5abf15563a3a176f46ec4bcdc602c716eb9d5737.zip | |
Avoid global recursive calls to kill-buffer-hooks, and fit into 80 cols.
* lisp/textmodes/ispell.el (ispell-process-buffer-name): Remove.
(ispell-start-process): Avoid setq and simplify logic.
(ispell-init-process): Setup kill-buffer-hook locally when needed.
(kill-buffer-hook): Don't use it globally with code that uses
expand-file-name since that may call kill-buffer via
code_conversion_restore.
| -rw-r--r-- | lisp/ChangeLog | 14 | ||||
| -rw-r--r-- | lisp/textmodes/ispell.el | 194 |
2 files changed, 114 insertions, 94 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 28092a6a086..c463614a34b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2010-09-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | Avoid global recursive calls to kill-buffer-hooks, and fit into 80 cols. | ||
| 4 | * textmodes/ispell.el (ispell-process-buffer-name): Remove. | ||
| 5 | (ispell-start-process): Avoid setq and simplify logic. | ||
| 6 | (ispell-init-process): Setup kill-buffer-hook locally when needed. | ||
| 7 | (kill-buffer-hook): Don't use it globally with code that uses | ||
| 8 | expand-file-name since that may call kill-buffer via | ||
| 9 | code_conversion_restore. | ||
| 10 | |||
| 1 | 2010-09-04 Noorul Islam K M <noorul@noorul.com> (tiny change) | 11 | 2010-09-04 Noorul Islam K M <noorul@noorul.com> (tiny change) |
| 2 | 12 | ||
| 3 | * emacs-lisp/package.el (package-directory-list): Only call | 13 | * emacs-lisp/package.el (package-directory-list): Only call |
| @@ -5,8 +15,8 @@ | |||
| 5 | 15 | ||
| 6 | 2010-09-02 Chong Yidong <cyd@stupidchicken.com> | 16 | 2010-09-02 Chong Yidong <cyd@stupidchicken.com> |
| 7 | 17 | ||
| 8 | * emacs-lisp/package.el (package--download-one-archive): Ensure | 18 | * emacs-lisp/package.el (package--download-one-archive): |
| 9 | that archive-contents is valid before saving it. | 19 | Ensure that archive-contents is valid before saving it. |
| 10 | (package-activate-1, package-mark-obsolete, define-package) | 20 | (package-activate-1, package-mark-obsolete, define-package) |
| 11 | (package-compute-transaction, package-list-maybe-add): Use push. | 21 | (package-compute-transaction, package-list-maybe-add): Use push. |
| 12 | 22 | ||
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 64253593a79..e30da02df4f 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el | |||
| @@ -221,10 +221,10 @@ compatibility function in case `version<=' is not available." | |||
| 221 | (let (ver mver) | 221 | (let (ver mver) |
| 222 | (if (string-match "[0-9]+" version start-ver) | 222 | (if (string-match "[0-9]+" version start-ver) |
| 223 | (setq start-ver (match-end 0) | 223 | (setq start-ver (match-end 0) |
| 224 | ver (string-to-number (substring version (match-beginning 0) (match-end 0))))) | 224 | ver (string-to-number (match-string 0 version)))) |
| 225 | (if (string-match "[0-9]+" minver start-mver) | 225 | (if (string-match "[0-9]+" minver start-mver) |
| 226 | (setq start-mver (match-end 0) | 226 | (setq start-mver (match-end 0) |
| 227 | mver (string-to-number (substring minver (match-beginning 0) (match-end 0))))) | 227 | mver (string-to-number (match-string 0 minver)))) |
| 228 | 228 | ||
| 229 | (if (or ver mver) | 229 | (if (or ver mver) |
| 230 | (progn | 230 | (progn |
| @@ -310,7 +310,9 @@ Warning! Not checking comments, when a comment start is embedded in strings, | |||
| 310 | may produce undesired results." | 310 | may produce undesired results." |
| 311 | :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t)) | 311 | :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t)) |
| 312 | :group 'ispell) | 312 | :group 'ispell) |
| 313 | ;;;###autoload(put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive)))) | 313 | ;;;###autoload |
| 314 | (put 'ispell-check-comments 'safe-local-variable | ||
| 315 | (lambda (a) (memq a '(nil t exclusive)))) | ||
| 314 | 316 | ||
| 315 | (defcustom ispell-query-replace-choices nil | 317 | (defcustom ispell-query-replace-choices nil |
| 316 | "*Corrections made throughout region when non-nil. | 318 | "*Corrections made throughout region when non-nil. |
| @@ -514,7 +516,8 @@ is automatically set when defined in the file with either | |||
| 514 | :type '(choice string | 516 | :type '(choice string |
| 515 | (const :tag "default" nil)) | 517 | (const :tag "default" nil)) |
| 516 | :group 'ispell) | 518 | :group 'ispell) |
| 517 | ;;;###autoload(put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p) | 519 | ;;;###autoload |
| 520 | (put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p) | ||
| 518 | 521 | ||
| 519 | (make-variable-buffer-local 'ispell-local-dictionary) | 522 | (make-variable-buffer-local 'ispell-local-dictionary) |
| 520 | 523 | ||
| @@ -738,8 +741,8 @@ Note that the CASECHARS and OTHERCHARS slots of the alist should | |||
| 738 | contain the same character set as casechars and otherchars in the | 741 | contain the same character set as casechars and otherchars in the |
| 739 | LANGUAGE.aff file \(e.g., english.aff\).") | 742 | LANGUAGE.aff file \(e.g., english.aff\).") |
| 740 | 743 | ||
| 741 | (defvar ispell-really-aspell nil) ; Non-nil if aspell extensions should be used | 744 | (defvar ispell-really-aspell nil) ; Non-nil if we can use aspell extensions. |
| 742 | (defvar ispell-really-hunspell nil) ; Non-nil if hunspell extensions should be used | 745 | (defvar ispell-really-hunspell nil) ; Non-nil if we can use hunspell extensions. |
| 743 | (defvar ispell-encoding8-command nil | 746 | (defvar ispell-encoding8-command nil |
| 744 | "Command line option prefix to select UTF-8 if supported, nil otherwise. | 747 | "Command line option prefix to select UTF-8 if supported, nil otherwise. |
| 745 | If UTF-8 if supported by spellchecker and is selectable from the command line | 748 | If UTF-8 if supported by spellchecker and is selectable from the command line |
| @@ -962,7 +965,8 @@ Internal use.") | |||
| 962 | (setq found (nconc found (list dict))))) | 965 | (setq found (nconc found (list dict))))) |
| 963 | (setq ispell-aspell-dictionary-alist found) | 966 | (setq ispell-aspell-dictionary-alist found) |
| 964 | ;; Add a default entry | 967 | ;; Add a default entry |
| 965 | (let ((default-dict '(nil "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil utf-8))) | 968 | (let ((default-dict |
| 969 | '(nil "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil utf-8))) | ||
| 966 | (push default-dict ispell-aspell-dictionary-alist)))) | 970 | (push default-dict ispell-aspell-dictionary-alist)))) |
| 967 | 971 | ||
| 968 | (defvar ispell-aspell-data-dir nil | 972 | (defvar ispell-aspell-data-dir nil |
| @@ -1026,7 +1030,8 @@ Assumes that value contains no whitespace." | |||
| 1026 | (defun ispell-aspell-add-aliases (alist) | 1030 | (defun ispell-aspell-add-aliases (alist) |
| 1027 | "Find aspell's dictionary aliases and add them to dictionary ALIST. | 1031 | "Find aspell's dictionary aliases and add them to dictionary ALIST. |
| 1028 | Return the new dictionary alist." | 1032 | Return the new dictionary alist." |
| 1029 | (let ((aliases (file-expand-wildcards | 1033 | (let ((aliases |
| 1034 | (file-expand-wildcards | ||
| 1030 | (concat (or ispell-aspell-dict-dir | 1035 | (concat (or ispell-aspell-dict-dir |
| 1031 | (setq ispell-aspell-dict-dir | 1036 | (setq ispell-aspell-dict-dir |
| 1032 | (ispell-get-aspell-config-value "dict-dir"))) | 1037 | (ispell-get-aspell-config-value "dict-dir"))) |
| @@ -1168,7 +1173,8 @@ The variable `ispell-library-directory' defines the library location." | |||
| 1168 | `(menu-item ,(purecopy "Complete Word") ispell-complete-word | 1173 | `(menu-item ,(purecopy "Complete Word") ispell-complete-word |
| 1169 | :help ,(purecopy "Complete word at cursor using dictionary"))) | 1174 | :help ,(purecopy "Complete word at cursor using dictionary"))) |
| 1170 | (define-key ispell-menu-map [ispell-complete-word-interior-frag] | 1175 | (define-key ispell-menu-map [ispell-complete-word-interior-frag] |
| 1171 | `(menu-item ,(purecopy "Complete Word Fragment") ispell-complete-word-interior-frag | 1176 | `(menu-item ,(purecopy "Complete Word Fragment") |
| 1177 | ispell-complete-word-interior-frag | ||
| 1172 | :help ,(purecopy "Complete word fragment at cursor"))))) | 1178 | :help ,(purecopy "Complete word fragment at cursor"))))) |
| 1173 | 1179 | ||
| 1174 | ;;;###autoload | 1180 | ;;;###autoload |
| @@ -1185,7 +1191,8 @@ The variable `ispell-library-directory' defines the library location." | |||
| 1185 | `(menu-item ,(purecopy "Spell-Check Word") ispell-word | 1191 | `(menu-item ,(purecopy "Spell-Check Word") ispell-word |
| 1186 | :help ,(purecopy "Spell-check word at cursor"))) | 1192 | :help ,(purecopy "Spell-check word at cursor"))) |
| 1187 | (define-key ispell-menu-map [ispell-comments-and-strings] | 1193 | (define-key ispell-menu-map [ispell-comments-and-strings] |
| 1188 | `(menu-item ,(purecopy "Spell-Check Comments") ispell-comments-and-strings | 1194 | `(menu-item ,(purecopy "Spell-Check Comments") |
| 1195 | ispell-comments-and-strings | ||
| 1189 | :help ,(purecopy "Spell-check only comments and strings"))))) | 1196 | :help ,(purecopy "Spell-check only comments and strings"))))) |
| 1190 | 1197 | ||
| 1191 | ;;;###autoload | 1198 | ;;;###autoload |
| @@ -1334,9 +1341,6 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs." | |||
| 1334 | (defvar ispell-process-directory nil | 1341 | (defvar ispell-process-directory nil |
| 1335 | "The directory where `ispell-process' was started.") | 1342 | "The directory where `ispell-process' was started.") |
| 1336 | 1343 | ||
| 1337 | (defvar ispell-process-buffer-name nil | ||
| 1338 | "The buffer where `ispell-process' was started.") | ||
| 1339 | |||
| 1340 | (defvar ispell-filter nil | 1344 | (defvar ispell-filter nil |
| 1341 | "Output filter from piped calls to Ispell.") | 1345 | "Output filter from piped calls to Ispell.") |
| 1342 | 1346 | ||
| @@ -1400,7 +1404,8 @@ The last occurring definition in the buffer will be used.") | |||
| 1400 | (ispell-dictionary-keyword forward-line) | 1404 | (ispell-dictionary-keyword forward-line) |
| 1401 | (ispell-pdict-keyword forward-line) | 1405 | (ispell-pdict-keyword forward-line) |
| 1402 | (ispell-parsing-keyword forward-line) | 1406 | (ispell-parsing-keyword forward-line) |
| 1403 | (,(purecopy "^---*BEGIN PGP [A-Z ]*--*") . ,(purecopy "^---*END PGP [A-Z ]*--*")) | 1407 | (,(purecopy "^---*BEGIN PGP [A-Z ]*--*") |
| 1408 | . ,(purecopy "^---*END PGP [A-Z ]*--*")) | ||
| 1404 | ;; assume multiline uuencoded file? "\nM.*$"? | 1409 | ;; assume multiline uuencoded file? "\nM.*$"? |
| 1405 | (,(purecopy "^begin [0-9][0-9][0-9] [^ \t]+$") . ,(purecopy "\nend\n")) | 1410 | (,(purecopy "^begin [0-9][0-9][0-9] [^ \t]+$") . ,(purecopy "\nend\n")) |
| 1406 | (,(purecopy "^%!PS-Adobe-[123].0") . ,(purecopy "\n%%EOF\n")) | 1411 | (,(purecopy "^%!PS-Adobe-[123].0") . ,(purecopy "\n%%EOF\n")) |
| @@ -1880,9 +1885,10 @@ Global `ispell-quit' set to start location to continue spell session." | |||
| 1880 | ;; setup the *Choices* buffer with valid data. | 1885 | ;; setup the *Choices* buffer with valid data. |
| 1881 | (with-current-buffer (get-buffer-create ispell-choices-buffer) | 1886 | (with-current-buffer (get-buffer-create ispell-choices-buffer) |
| 1882 | (setq mode-line-format | 1887 | (setq mode-line-format |
| 1883 | (concat "-- %b -- word: " word | 1888 | (concat |
| 1884 | " -- dict: " (or ispell-current-dictionary "default") | 1889 | "-- %b -- word: " word |
| 1885 | " -- prog: " (file-name-nondirectory ispell-program-name))) | 1890 | " -- dict: " (or ispell-current-dictionary "default") |
| 1891 | " -- prog: " (file-name-nondirectory ispell-program-name))) | ||
| 1886 | ;; XEmacs: no need for horizontal scrollbar in choices window | 1892 | ;; XEmacs: no need for horizontal scrollbar in choices window |
| 1887 | (with-no-warnings | 1893 | (with-no-warnings |
| 1888 | (and (fboundp 'set-specifier) | 1894 | (and (fboundp 'set-specifier) |
| @@ -2280,8 +2286,9 @@ if defined." | |||
| 2280 | (unless (file-readable-p lookup-dict) | 2286 | (unless (file-readable-p lookup-dict) |
| 2281 | (error "lookup-words error: Unreadable or missing plain word-list %s." | 2287 | (error "lookup-words error: Unreadable or missing plain word-list %s." |
| 2282 | lookup-dict)) | 2288 | lookup-dict)) |
| 2283 | (error (concat "lookup-words error: No plain word-list found at system default " | 2289 | (error (concat "lookup-words error: No plain word-list found at system" |
| 2284 | "locations. Customize `ispell-alternate-dictionary' to set yours."))) | 2290 | "default locations. " |
| 2291 | "Customize `ispell-alternate-dictionary' to set yours."))) | ||
| 2285 | 2292 | ||
| 2286 | (let* ((process-connection-type ispell-use-ptys-p) | 2293 | (let* ((process-connection-type ispell-use-ptys-p) |
| 2287 | (wild-p (string-match "\\*" word)) | 2294 | (wild-p (string-match "\\*" word)) |
| @@ -2332,16 +2339,16 @@ if defined." | |||
| 2332 | results)) | 2339 | results)) |
| 2333 | 2340 | ||
| 2334 | 2341 | ||
| 2335 | ;;; "ispell-filter" is a list of output lines from the generating function. | 2342 | ;; "ispell-filter" is a list of output lines from the generating function. |
| 2336 | ;;; Each full line (ending with \n) is a separate item on the list. | 2343 | ;; Each full line (ending with \n) is a separate item on the list. |
| 2337 | ;;; "output" can contain multiple lines, part of a line, or both. | 2344 | ;; "output" can contain multiple lines, part of a line, or both. |
| 2338 | ;;; "start" and "end" are used to keep bounds on lines when "output" contains | 2345 | ;; "start" and "end" are used to keep bounds on lines when "output" contains |
| 2339 | ;;; multiple lines. | 2346 | ;; multiple lines. |
| 2340 | ;;; "ispell-filter-continue" is true when we have received only part of a | 2347 | ;; "ispell-filter-continue" is true when we have received only part of a |
| 2341 | ;;; line as output from a generating function ("output" did not end with \n) | 2348 | ;; line as output from a generating function ("output" did not end with \n) |
| 2342 | ;;; THIS FUNCTION WILL FAIL IF THE PROCESS OUTPUT DOESN'T END WITH \n! | 2349 | ;; THIS FUNCTION WILL FAIL IF THE PROCESS OUTPUT DOESN'T END WITH \n! |
| 2343 | ;;; This is the case when a process dies or fails. The default behavior | 2350 | ;; This is the case when a process dies or fails. The default behavior |
| 2344 | ;;; in this case treats the next input received as fresh input. | 2351 | ;; in this case treats the next input received as fresh input. |
| 2345 | 2352 | ||
| 2346 | (defun ispell-filter (process output) | 2353 | (defun ispell-filter (process output) |
| 2347 | "Output filter function for ispell, grep, and look." | 2354 | "Output filter function for ispell, grep, and look." |
| @@ -2573,37 +2580,34 @@ When asynchronous processes are not supported, `run' is always returned." | |||
| 2573 | (defun ispell-start-process () | 2580 | (defun ispell-start-process () |
| 2574 | "Start the ispell process, with support for no asynchronous processes. | 2581 | "Start the ispell process, with support for no asynchronous processes. |
| 2575 | Keeps argument list for future ispell invocations for no async support." | 2582 | Keeps argument list for future ispell invocations for no async support." |
| 2576 | (let ((default-directory default-directory) | 2583 | ;; Local dictionary becomes the global dictionary in use. |
| 2577 | args) | 2584 | (setq ispell-current-dictionary |
| 2578 | (unless (and (file-directory-p default-directory) | 2585 | (or ispell-local-dictionary ispell-dictionary)) |
| 2579 | (file-readable-p default-directory)) | 2586 | (setq ispell-current-personal-dictionary |
| 2580 | ;; Defend against bad `default-directory'. | 2587 | (or ispell-local-pdict ispell-personal-dictionary)) |
| 2581 | (setq default-directory (expand-file-name "~/"))) | 2588 | (let* ((default-directory |
| 2582 | ;; Local dictionary becomes the global dictionary in use. | 2589 | (if (and (file-directory-p default-directory) |
| 2583 | (setq ispell-current-dictionary | 2590 | (file-readable-p default-directory)) |
| 2584 | (or ispell-local-dictionary ispell-dictionary)) | 2591 | default-directory |
| 2585 | (setq ispell-current-personal-dictionary | 2592 | ;; Defend against bad `default-directory'. |
| 2586 | (or ispell-local-pdict ispell-personal-dictionary)) | 2593 | (expand-file-name "~/"))) |
| 2587 | (setq args (ispell-get-ispell-args)) | 2594 | (args |
| 2588 | (if (and ispell-current-dictionary ; use specified dictionary | 2595 | (append |
| 2589 | (not (member "-d" args))) ; only define if not overridden | 2596 | (if (and ispell-current-dictionary ; Use specified dictionary. |
| 2590 | (setq args | 2597 | (not (member "-d" args))) ; Only define if not overridden. |
| 2591 | (append (list "-d" ispell-current-dictionary) args))) | 2598 | (list "-d" ispell-current-dictionary)) |
| 2592 | (if ispell-current-personal-dictionary ; use specified pers dict | 2599 | (ispell-get-ispell-args) |
| 2593 | (setq args | 2600 | (if ispell-current-personal-dictionary ; Use specified pers dict. |
| 2594 | (append args | 2601 | (list "-p" |
| 2595 | (list "-p" | 2602 | (expand-file-name ispell-current-personal-dictionary))) |
| 2596 | (expand-file-name ispell-current-personal-dictionary))))) | 2603 | ;; If we are using recent aspell or hunspell, make sure we use the |
| 2597 | 2604 | ;; right encoding for communication. ispell or older aspell/hunspell | |
| 2598 | ;; If we are using recent aspell or hunspell, make sure we use the right encoding | 2605 | ;; does not support this. |
| 2599 | ;; for communication. ispell or older aspell/hunspell does not support this | 2606 | (if ispell-encoding8-command |
| 2600 | (if ispell-encoding8-command | 2607 | (list |
| 2601 | (setq args | 2608 | (concat ispell-encoding8-command |
| 2602 | (append args | 2609 | (symbol-name (ispell-get-coding-system))))) |
| 2603 | (list | 2610 | ispell-extra-args))) |
| 2604 | (concat ispell-encoding8-command | ||
| 2605 | (symbol-name (ispell-get-coding-system))))))) | ||
| 2606 | (setq args (append args ispell-extra-args)) | ||
| 2607 | 2611 | ||
| 2608 | ;; Initially we don't know any buffer's local words. | 2612 | ;; Initially we don't know any buffer's local words. |
| 2609 | (setq ispell-buffer-local-name nil) | 2613 | (setq ispell-buffer-local-name nil) |
| @@ -2612,9 +2616,11 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2612 | (let ((process-connection-type ispell-use-ptys-p)) | 2616 | (let ((process-connection-type ispell-use-ptys-p)) |
| 2613 | (apply 'start-process | 2617 | (apply 'start-process |
| 2614 | "ispell" nil ispell-program-name | 2618 | "ispell" nil ispell-program-name |
| 2615 | "-a" ; accept single input lines | 2619 | "-a" ; Accept single input lines. |
| 2616 | (if ispell-really-hunspell "" "-m") ; make root/affix combos not in dict | 2620 | ;; Make root/affix combos not in dict. |
| 2617 | args)) ; hunspell -m option means different | 2621 | ;; hunspell -m option means different. |
| 2622 | (if ispell-really-hunspell "" "-m") | ||
| 2623 | args)) | ||
| 2618 | (setq ispell-cmd-args args | 2624 | (setq ispell-cmd-args args |
| 2619 | ispell-output-buffer (generate-new-buffer " *ispell-output*") | 2625 | ispell-output-buffer (generate-new-buffer " *ispell-output*") |
| 2620 | ispell-session-buffer (generate-new-buffer " *ispell-session*")) | 2626 | ispell-session-buffer (generate-new-buffer " *ispell-session*")) |
| @@ -2650,10 +2656,11 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2650 | ;; Check if process needs restart | 2656 | ;; Check if process needs restart |
| 2651 | (if (and ispell-process | 2657 | (if (and ispell-process |
| 2652 | (eq (ispell-process-status) 'run) | 2658 | (eq (ispell-process-status) 'run) |
| 2653 | ;; Unless we are using an explicit personal dictionary, | 2659 | ;; Unless we are using an explicit personal dictionary, ensure |
| 2654 | ;; ensure we're in the same default directory! | 2660 | ;; we're in the same default directory! Restart check for |
| 2655 | ;; Restart check for personal dictionary is done in | 2661 | ;; personal dictionary is done in |
| 2656 | ;; `ispell-internal-change-dictionary', called from `ispell-buffer-local-dict' | 2662 | ;; `ispell-internal-change-dictionary', called from |
| 2663 | ;; `ispell-buffer-local-dict' | ||
| 2657 | (or (or ispell-local-pdict ispell-personal-dictionary) | 2664 | (or (or ispell-local-pdict ispell-personal-dictionary) |
| 2658 | (equal ispell-process-directory default-directory))) | 2665 | (equal ispell-process-directory default-directory))) |
| 2659 | (setq ispell-filter nil ispell-filter-continue nil) | 2666 | (setq ispell-filter nil ispell-filter-continue nil) |
| @@ -2667,17 +2674,25 @@ Keeps argument list for future ispell invocations for no async support." | |||
| 2667 | ispell-filter nil | 2674 | ispell-filter nil |
| 2668 | ispell-filter-continue nil | 2675 | ispell-filter-continue nil |
| 2669 | ispell-process-directory default-directory) | 2676 | ispell-process-directory default-directory) |
| 2670 | ;; When spellchecking minibuffer contents, assign ispell process to parent | 2677 | |
| 2671 | ;; buffer if known (not known for XEmacs). Use (buffer-name) otherwise. | 2678 | ;; Kill ispell process when killing its associated buffer if using Ispell |
| 2672 | (setq ispell-process-buffer-name | 2679 | ;; per-directory personal dictionaries. |
| 2680 | (unless (equal ispell-process-directory (expand-file-name "~/")) | ||
| 2681 | (with-current-buffer | ||
| 2673 | (if (and (window-minibuffer-p) | 2682 | (if (and (window-minibuffer-p) |
| 2674 | (fboundp 'minibuffer-selected-window)) ;; Not XEmacs | 2683 | (fboundp 'minibuffer-selected-window)) ;; E.g. XEmacs. |
| 2684 | ;; When spellchecking minibuffer contents, assign ispell | ||
| 2685 | ;; process to parent buffer if known (not known for XEmacs). | ||
| 2686 | ;; Use (buffer-name) otherwise. | ||
| 2675 | (window-buffer (minibuffer-selected-window)) | 2687 | (window-buffer (minibuffer-selected-window)) |
| 2676 | (buffer-name))) | 2688 | (current-buffer)) |
| 2689 | (add-hook 'kill-buffer-hook (lambda () (ispell-kill-ispell t)) | ||
| 2690 | nil 'local))) | ||
| 2677 | 2691 | ||
| 2678 | (if ispell-async-processp | 2692 | (if ispell-async-processp |
| 2679 | (set-process-filter ispell-process 'ispell-filter)) | 2693 | (set-process-filter ispell-process 'ispell-filter)) |
| 2680 | ;; protect against bogus binding of `enable-multibyte-characters' in XEmacs | 2694 | ;; protect against bogus binding of `enable-multibyte-characters' in |
| 2695 | ;; XEmacs. | ||
| 2681 | (if (and (or (featurep 'xemacs) | 2696 | (if (and (or (featurep 'xemacs) |
| 2682 | (and (boundp 'enable-multibyte-characters) | 2697 | (and (boundp 'enable-multibyte-characters) |
| 2683 | enable-multibyte-characters)) | 2698 | enable-multibyte-characters)) |
| @@ -2735,19 +2750,10 @@ With NO-ERROR, just return non-nil if there was no Ispell running." | |||
| 2735 | (kill-buffer ispell-session-buffer) | 2750 | (kill-buffer ispell-session-buffer) |
| 2736 | (setq ispell-output-buffer nil | 2751 | (setq ispell-output-buffer nil |
| 2737 | ispell-session-buffer nil)) | 2752 | ispell-session-buffer nil)) |
| 2738 | (setq ispell-process-buffer-name nil) | ||
| 2739 | (setq ispell-process nil) | 2753 | (setq ispell-process nil) |
| 2740 | (message "Ispell process killed") | 2754 | (message "Ispell process killed") |
| 2741 | nil)) | 2755 | nil)) |
| 2742 | 2756 | ||
| 2743 | ;; Kill ispell process when killing its associated buffer if using Ispell | ||
| 2744 | ;; per-directory personal dictionaries. | ||
| 2745 | (add-hook 'kill-buffer-hook | ||
| 2746 | '(lambda () | ||
| 2747 | (if (and (not (equal ispell-process-directory (expand-file-name "~/"))) | ||
| 2748 | (equal ispell-process-buffer-name (buffer-name))) | ||
| 2749 | (ispell-kill-ispell t)))) | ||
| 2750 | |||
| 2751 | ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should | 2757 | ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should |
| 2752 | ;;; call ispell-init-process rather than wait for a spell checking command? | 2758 | ;;; call ispell-init-process rather than wait for a spell checking command? |
| 2753 | 2759 | ||
| @@ -2844,9 +2850,10 @@ Return nil if spell session is quit, | |||
| 2844 | (set-marker skip-region-start (- (point) (length key))) | 2850 | (set-marker skip-region-start (- (point) (length key))) |
| 2845 | (goto-char reg-start))) | 2851 | (goto-char reg-start))) |
| 2846 | (let (message-log-max) | 2852 | (let (message-log-max) |
| 2847 | (message "Continuing spelling check using %s with %s dictionary..." | 2853 | (message |
| 2848 | (file-name-nondirectory ispell-program-name) | 2854 | "Continuing spelling check using %s with %s dictionary..." |
| 2849 | (or ispell-current-dictionary "default"))) | 2855 | (file-name-nondirectory ispell-program-name) |
| 2856 | (or ispell-current-dictionary "default"))) | ||
| 2850 | (set-marker rstart reg-start) | 2857 | (set-marker rstart reg-start) |
| 2851 | (set-marker ispell-region-end reg-end) | 2858 | (set-marker ispell-region-end reg-end) |
| 2852 | (while (and (not ispell-quit) | 2859 | (while (and (not ispell-quit) |
| @@ -3111,9 +3118,9 @@ Point is placed at end of skipped region." | |||
| 3111 | (sit-for 2))))) | 3118 | (sit-for 2))))) |
| 3112 | 3119 | ||
| 3113 | 3120 | ||
| 3114 | ;;; Grab the next line of data. | ||
| 3115 | ;;; Returns a string with the line data | ||
| 3116 | (defun ispell-get-line (start end in-comment) | 3121 | (defun ispell-get-line (start end in-comment) |
| 3122 | "Grab the next line of data. | ||
| 3123 | Returns a string with the line data." | ||
| 3117 | (let ((ispell-casechars (ispell-get-casechars)) | 3124 | (let ((ispell-casechars (ispell-get-casechars)) |
| 3118 | string) | 3125 | string) |
| 3119 | (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS | 3126 | (cond ; LOOK AT THIS LINE AND SKIP OR PROCESS |
| @@ -3140,7 +3147,8 @@ Point is placed at end of skipped region." | |||
| 3140 | (point) (+ (point) len)) | 3147 | (point) (+ (point) len)) |
| 3141 | coding))))) | 3148 | coding))))) |
| 3142 | 3149 | ||
| 3143 | ;;; Avoid error messages when compiling for these dynamic variables. | 3150 | ;; Avoid error messages when compiling for these dynamic variables. |
| 3151 | ;; FIXME: dynamically scoped vars should have an "ispell-" prefix. | ||
| 3144 | (defvar start) | 3152 | (defvar start) |
| 3145 | (defvar end) | 3153 | (defvar end) |
| 3146 | 3154 | ||
| @@ -3275,10 +3283,12 @@ Returns the sum SHIFT due to changes in word replacements." | |||
| 3275 | ;; (length (car poss))))) | 3283 | ;; (length (car poss))))) |
| 3276 | )) | 3284 | )) |
| 3277 | (if (not ispell-quit) | 3285 | (if (not ispell-quit) |
| 3286 | ;; FIXME: remove redundancy with identical code above. | ||
| 3278 | (let (message-log-max) | 3287 | (let (message-log-max) |
| 3279 | (message "Continuing spelling check using %s with %s dictionary..." | 3288 | (message |
| 3280 | (file-name-nondirectory ispell-program-name) | 3289 | "Continuing spelling check using %s with %s dictionary..." |
| 3281 | (or ispell-current-dictionary "default")))) | 3290 | (file-name-nondirectory ispell-program-name) |
| 3291 | (or ispell-current-dictionary "default")))) | ||
| 3282 | (sit-for 0) | 3292 | (sit-for 0) |
| 3283 | (setq start (marker-position line-start) | 3293 | (setq start (marker-position line-start) |
| 3284 | end (marker-position line-end)) | 3294 | end (marker-position line-end)) |
| @@ -3351,7 +3361,7 @@ Returns the sum SHIFT due to changes in word replacements." | |||
| 3351 | 3361 | ||
| 3352 | 3362 | ||
| 3353 | ;;; Interactive word completion. | 3363 | ;;; Interactive word completion. |
| 3354 | ;;; Forces "previous-word" processing. Do we want to make this selectable? | 3364 | ;; Forces "previous-word" processing. Do we want to make this selectable? |
| 3355 | 3365 | ||
| 3356 | ;;;###autoload | 3366 | ;;;###autoload |
| 3357 | (defun ispell-complete-word (&optional interior-frag) | 3367 | (defun ispell-complete-word (&optional interior-frag) |