diff options
| author | Richard M. Stallman | 1993-06-10 20:35:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-10 20:35:05 +0000 |
| commit | a6c5a8dd703e64d102e90363e9dd44c187c9c862 (patch) | |
| tree | 1b976bd42b06d7759512e979376c55dd473b17bd /lisp | |
| parent | 8760d5df1f7467df05151842e5cafdc6185c58aa (diff) | |
| download | emacs-a6c5a8dd703e64d102e90363e9dd44c187c9c862.tar.gz emacs-a6c5a8dd703e64d102e90363e9dd44c187c9c862.zip | |
Doc fixes.
(ispell-command, ispell-command-options): New defvars.
(start-ispell): Use them.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/textmodes/ispell4.el | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/lisp/textmodes/ispell4.el b/lisp/textmodes/ispell4.el index ff37d27ce4d..1effe91d68c 100644 --- a/lisp/textmodes/ispell4.el +++ b/lisp/textmodes/ispell4.el | |||
| @@ -28,15 +28,22 @@ | |||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (defvar ispell-have-new-look t | 30 | (defvar ispell-have-new-look t |
| 31 | "T if default 'look' program has the -r flag.") | 31 | "Non-nil means use the `-r' option when running `look'.") |
| 32 | 32 | ||
| 33 | (defvar ispell-enable-tex-parser nil | 33 | (defvar ispell-enable-tex-parser nil |
| 34 | "T to enable experimental tex parser in ispell for tex buffers.") | 34 | "Non-nil enables experimental TeX parser in Ispell for TeX-mode buffers.") |
| 35 | 35 | ||
| 36 | (defvar ispell-process nil "The process running ISPELL") | 36 | (defvar ispell-process nil "The process running Ispell") |
| 37 | (defvar ispell-next-message nil | 37 | (defvar ispell-next-message nil |
| 38 | "An integer telling where in the *ispell* buffer where | 38 | "An integer: where in `*ispell*' buffer to find next message from Ispell.") |
| 39 | to look for the next message from the ISPELL program.") | 39 | |
| 40 | (defvar ispell-command "ispell" | ||
| 41 | "Command for running Ispell.") | ||
| 42 | (defvar ispell-command-options nil | ||
| 43 | "*String (or list of strings) to pass to Ispell as command arguments. | ||
| 44 | You can use this to specify the name of your private dictionary. | ||
| 45 | The -S option is always passed to Ispell as the last parameter, | ||
| 46 | and need not be mentioned here.") | ||
| 40 | 47 | ||
| 41 | ;Each marker in this list points to the start of a word that | 48 | ;Each marker in this list points to the start of a word that |
| 42 | ;ispell thought was bad last time it did the :file command. | 49 | ;ispell thought was bad last time it did the :file command. |
| @@ -47,7 +54,7 @@ to look for the next message from the ISPELL program.") | |||
| 47 | ;without the select system call. Therefore, see the variable | 54 | ;without the select system call. Therefore, see the variable |
| 48 | ;ispell-recently-accepted. | 55 | ;ispell-recently-accepted. |
| 49 | (defvar ispell-bad-words nil | 56 | (defvar ispell-bad-words nil |
| 50 | "A list of markers corresponding to the output of the ISPELL :file command.") | 57 | "A list of markers reflecting the output of the Ispell `:file' command.") |
| 51 | 58 | ||
| 52 | ;list of words that the user has accepted, but that might still | 59 | ;list of words that the user has accepted, but that might still |
| 53 | ;be on the bad-words list | 60 | ;be on the bad-words list |
| @@ -68,7 +75,7 @@ to look for the next message from the ISPELL program.") | |||
| 68 | (setq ispell-recently-accepted nil)) | 75 | (setq ispell-recently-accepted nil)) |
| 69 | 76 | ||
| 70 | (defun kill-ispell () | 77 | (defun kill-ispell () |
| 71 | "Kill the ispell process. | 78 | "Kill the Ispell process. |
| 72 | Any changes in your private dictionary | 79 | Any changes in your private dictionary |
| 73 | that have not already been dumped will be lost." | 80 | that have not already been dumped will be lost." |
| 74 | (interactive) | 81 | (interactive) |
| @@ -82,14 +89,20 @@ that have not already been dumped will be lost." | |||
| 82 | (put 'ispell-startup-error 'error-message | 89 | (put 'ispell-startup-error 'error-message |
| 83 | "Problem starting ispell - see buffer *ispell*") | 90 | "Problem starting ispell - see buffer *ispell*") |
| 84 | 91 | ||
| 92 | ;; Start an ispell subprocess; check the version; and display the greeting. | ||
| 93 | |||
| 85 | (defun start-ispell () | 94 | (defun start-ispell () |
| 86 | "Start an ispell subprocess; check the version; and display the greeting." | ||
| 87 | (message "Starting ispell ...") | 95 | (message "Starting ispell ...") |
| 88 | (let ((buf (get-buffer "*ispell*"))) | 96 | (let ((buf (get-buffer "*ispell*"))) |
| 89 | (if buf | 97 | (if buf |
| 90 | (kill-buffer buf))) | 98 | (kill-buffer buf))) |
| 91 | (condition-case err | 99 | (condition-case err |
| 92 | (setq ispell-process (start-process "ispell" "*ispell*" "ispell" "-S")) | 100 | (setq ispell-process |
| 101 | (apply 'start-process "ispell" "*ispell*" ispell-command | ||
| 102 | (append (if (listp ispell-command-options) | ||
| 103 | ispell-command-options | ||
| 104 | (list ispell-command-options)) | ||
| 105 | '("-S")))) | ||
| 93 | (file-error (signal 'ispell-startup-error nil))) | 106 | (file-error (signal 'ispell-startup-error nil))) |
| 94 | (process-kill-without-query ispell-process) | 107 | (process-kill-without-query ispell-process) |
| 95 | (buffer-disable-undo (process-buffer ispell-process)) | 108 | (buffer-disable-undo (process-buffer ispell-process)) |
| @@ -112,9 +125,10 @@ that have not already been dumped will be lost." | |||
| 112 | (message (car (cdr greeting)))) | 125 | (message (car (cdr greeting)))) |
| 113 | (delete-region (point-min) last-char)))) | 126 | (delete-region (point-min) last-char)))) |
| 114 | 127 | ||
| 115 | ;leaves buffer set to *ispell*, point at '=' | 128 | ;; Make sure ispell is ready for a command. |
| 129 | ;; Leaves buffer set to *ispell*, point at '='. | ||
| 130 | |||
| 116 | (defun ispell-sync (intr) | 131 | (defun ispell-sync (intr) |
| 117 | "Make sure ispell is ready for a command." | ||
| 118 | (if (or (null ispell-process) | 132 | (if (or (null ispell-process) |
| 119 | (not (eq (process-status ispell-process) 'run))) | 133 | (not (eq (process-status ispell-process) 'run))) |
| 120 | (start-ispell)) | 134 | (start-ispell)) |
| @@ -129,30 +143,30 @@ that have not already been dumped will be lost." | |||
| 129 | (setq last-char (- (point-max) 1))) | 143 | (setq last-char (- (point-max) 1))) |
| 130 | (goto-char last-char))) | 144 | (goto-char last-char))) |
| 131 | 145 | ||
| 132 | (defun ispell-cmd (&rest strings) | 146 | ;; Send a command to ispell. Choices are: |
| 133 | "Send a command to ispell. Choices are: | 147 | ;; |
| 134 | 148 | ;; WORD Check spelling of WORD. Result is | |
| 135 | WORD Check spelling of WORD. Result is | 149 | ;; |
| 136 | 150 | ;; nil not found | |
| 137 | nil not found | 151 | ;; t spelled ok |
| 138 | t spelled ok | 152 | ;; list of strings near misses |
| 139 | list of strings near misses | 153 | ;; |
| 154 | ;; :file FILENAME scan the named file, and print the file offsets of | ||
| 155 | ;; any misspelled words | ||
| 156 | ;; | ||
| 157 | ;; :insert WORD put word in private dictionary | ||
| 158 | ;; | ||
| 159 | ;; :accept WORD don't complain about word any more this session | ||
| 160 | ;; | ||
| 161 | ;; :dump write out the current private dictionary, if necessary. | ||
| 162 | ;; | ||
| 163 | ;; :reload reread `~/ispell.words' | ||
| 164 | ;; | ||
| 165 | ;; :tex | ||
| 166 | ;; :troff | ||
| 167 | ;; :generic set type of parser to use when scanning whole files | ||
| 140 | 168 | ||
| 141 | :file FILENAME scan the named file, and print the file offsets of | 169 | (defun ispell-cmd (&rest strings) |
| 142 | any misspelled words | ||
| 143 | |||
| 144 | :insert WORD put word in private dictionary | ||
| 145 | |||
| 146 | :accept WORD don't complain about word any more this session | ||
| 147 | |||
| 148 | :dump write out the current private dictionary, if necessary. | ||
| 149 | |||
| 150 | :reload reread `~/ispell.words' | ||
| 151 | |||
| 152 | :tex | ||
| 153 | :troff | ||
| 154 | :generic set type of parser to use when scanning whole files | ||
| 155 | " | ||
| 156 | (save-excursion | 170 | (save-excursion |
| 157 | (ispell-sync t) | 171 | (ispell-sync t) |
| 158 | (set-buffer (process-buffer ispell-process)) | 172 | (set-buffer (process-buffer ispell-process)) |
| @@ -182,9 +196,9 @@ WORD Check spelling of WORD. Result is | |||
| 182 | (if ispell-bad-words | 196 | (if ispell-bad-words |
| 183 | (setq ispell-recently-accepted (cons word ispell-recently-accepted)))) | 197 | (setq ispell-recently-accepted (cons word ispell-recently-accepted)))) |
| 184 | 198 | ||
| 199 | ;; Return the next message sent by the Ispell subprocess. | ||
| 185 | 200 | ||
| 186 | (defun ispell-next-message () | 201 | (defun ispell-next-message () |
| 187 | "Return the next message sent by the ispell subprocess." | ||
| 188 | (save-excursion | 202 | (save-excursion |
| 189 | (set-buffer (process-buffer ispell-process)) | 203 | (set-buffer (process-buffer ispell-process)) |
| 190 | (bury-buffer (current-buffer)) | 204 | (bury-buffer (current-buffer)) |
| @@ -281,7 +295,7 @@ q, \\[keyboard-quit] Leave the command loop. You can come back later with \\[is | |||
| 281 | (defalias 'ispell-buffer 'ispell) | 295 | (defalias 'ispell-buffer 'ispell) |
| 282 | 296 | ||
| 283 | (defun ispell-next () | 297 | (defun ispell-next () |
| 284 | "Resume command loop for most recent ispell command." | 298 | "Resume command loop for most recent Ispell command." |
| 285 | (interactive) | 299 | (interactive) |
| 286 | (setq ispell-window-configuration nil) | 300 | (setq ispell-window-configuration nil) |
| 287 | (unwind-protect | 301 | (unwind-protect |
| @@ -317,7 +331,7 @@ q, \\[keyboard-quit] Leave the command loop. You can come back later with \\[is | |||
| 317 | ;;;###autoload | 331 | ;;;###autoload |
| 318 | (defun ispell-word (&optional resume) | 332 | (defun ispell-word (&optional resume) |
| 319 | "Check the spelling of the word under the cursor. | 333 | "Check the spelling of the word under the cursor. |
| 320 | See `ispell' for more information. | 334 | See the command `ispell' for more information. |
| 321 | With a prefix argument, resume handling of the previous Ispell command." | 335 | With a prefix argument, resume handling of the previous Ispell command." |
| 322 | (interactive "P") | 336 | (interactive "P") |
| 323 | (if resume | 337 | (if resume |
| @@ -560,7 +574,7 @@ L lookup; Q quit\n") | |||
| 560 | (delete-region (point) end)) | 574 | (delete-region (point) end)) |
| 561 | 575 | ||
| 562 | (defun reload-ispell () | 576 | (defun reload-ispell () |
| 563 | "Tell ispell to re-read your private dictionary." | 577 | "Tell Ispell to re-read your private dictionary." |
| 564 | (interactive) | 578 | (interactive) |
| 565 | (ispell-cmd ":reload")) | 579 | (ispell-cmd ":reload")) |
| 566 | 580 | ||