• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/textmodes/

Lines Matching defs:ispell

0 ;;; ispell.el --- interface to International Ispell Versions 3.1 and 3.2
10 ;; Status : Release with 3.1.12+ and 3.2.0+ ispell.
11 ;; Bug Reports : ispell-el-bugs@itcorp.com
12 ;; Web Site : http://kdstevens.com/~stevens/ispell-page.html
48 ;; file. Use the variable `ispell-local-dictionary-alist' to specify
52 ;; (add-hook 'news-inews-hook 'ispell-message)
53 ;; (add-hook 'mail-send-hook 'ispell-message)
54 ;; (add-hook 'mh-before-send-letter-hook 'ispell-message)
57 ;; The parsing is controlled by the variable ispell-parser. Currently
64 ;; ispell-word
65 ;; ispell-region
66 ;; ispell-buffer
67 ;; ispell-message
68 ;; ispell-comments-and-strings
69 ;; ispell-continue
70 ;; ispell-complete-word
71 ;; ispell-complete-word-interior-frag
72 ;; ispell-change-dictionary
73 ;; ispell-kill-ispell
74 ;; ispell-pdict-save
75 ;; ispell-skip-region-alist
77 ;; Commands in ispell-region:
89 ;; `q': Quit spelling session (Kills ispell process).
99 ;; ispell for the current buffer. This includes language dictionaries,
106 ;; ispell-dictionary-keyword language-dictionary
107 ;; uses local variable ispell-local-dictionary
108 ;; ispell-pdict-keyword personal-dictionary
109 ;; uses local variable ispell-local-pdict
110 ;; ispell-parsing-keyword mode-arg extended-char-arg
111 ;; ispell-words-keyword any number of local word spellings
115 ;; spell check in `ispell-skip-region-alist'. Mode-dependent features can
116 ;; be added to latex by modifying `ispell-tex-skip-alists'.
117 ;; `ispell-message' contains some custom skipping code for e-mail messages.
125 ;; see `ispell-help-in-bufferp'.
137 ;; Minor fixes to get ispell menus right in XEmacs
140 ;; function `ispell-change-dictionary' now only completes valid dicts.
143 ;; Added fix for aspell to work in XEmacs (ispell-check-version).
149 ;; Clear minibuffer on ^G from ispell-help (Tak Ota)
168 ;; ispell-help fixed for XEmacs. Choices minibuffer now displayed in XEmacs.
174 ;; Accept ispell versions 3.X.Y where X>=1
175 ;; fine tuned latex region skipping. Fixed bug in ispell-word that did not
176 ;; point in right place on words < 2 chars. Simplified ispell-minor-mode.
188 ;; ispell-check-version added as an alias for `check-ispell-version'.
189 ;; Spelling suggestions returned in order generated by ispell.
190 ;; Small bug fixed in matching ispell error messages.
192 ;; Fixed bug that didn't respect case of word in `ispell-complete-word'.
194 ;; Ensure ispell process has terminated before starting new process.
195 ;; This can otherwise confuse process filters and hang ispell.
197 ;; Fixed bug using ^M rather than \r in `ispell-minor-check'.
198 ;; Improved message reference matching in `ispell-message'.
219 (defgroup ispell nil
220 "User variables for Emacs ispell interface."
227 (defalias 'check-ispell-version 'ispell-check-version)
237 (defcustom ispell-highlight-p 'block
241 :group 'ispell)
243 (defcustom ispell-lazy-highlight (boundp 'lazy-highlight-cleanup)
250 :group 'ispell
253 (defcustom ispell-highlight-face (if ispell-lazy-highlight 'isearch 'highlight)
261 :group 'ispell)
263 (defcustom ispell-check-comments t
269 :group 'ispell)
270 ;;;###autoload(put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive))))
272 (defcustom ispell-query-replace-choices nil
276 :group 'ispell)
278 (defcustom ispell-skip-tib nil
281 `ispell-tib-ref-beginning' and `ispell-tib-ref-end'.
284 your whole buffer -- unless you set `ispell-skip-tib' to nil. That includes
287 :group 'ispell)
289 (defvar ispell-tib-ref-beginning "[[<]\\."
292 (defvar ispell-tib-ref-end "\\.[]>]"
295 (defcustom ispell-keep-choices-win t
299 :group 'ispell)
301 (defcustom ispell-choices-win-default-height 2
305 :group 'ispell)
307 (defcustom ispell-program-name
309 "ispell")
310 "Program invoked by \\[ispell-word] and \\[ispell-region] commands."
312 :group 'ispell)
314 (defcustom ispell-alternate-dictionary
326 :group 'ispell)
328 (defcustom ispell-complete-word-dict ispell-alternate-dictionary
331 :group 'ispell)
333 (defcustom ispell-message-dictionary-alist nil
334 "*List used by `ispell-message' to select a new dictionary.
336 in the message headers, `ispell-local-dictionary' will be set to
337 DICTIONARY if `ispell-local-dictionary' is not buffer-local.
342 :group 'ispell)
345 (defcustom ispell-message-fcc-skip 50000
349 :group 'ispell)
352 (defcustom ispell-grep-command "egrep"
355 :group 'ispell)
357 (defcustom ispell-grep-options "-i"
358 "String of options to use when running the program in `ispell-grep-command'.
362 :group 'ispell)
364 (defcustom ispell-look-command
372 :group 'ispell)
374 (defcustom ispell-look-p (file-exists-p ispell-look-command)
378 :group 'ispell)
380 (defcustom ispell-have-new-look nil
383 :group 'ispell)
385 (defcustom ispell-look-options (if ispell-have-new-look "-dfr" "-df")
386 "String of command options for `ispell-look-command'."
388 :group 'ispell)
390 (defcustom ispell-use-ptys-p nil
394 :group 'ispell)
396 (defcustom ispell-following-word nil
397 "*Non-nil means `ispell-word' checks the word around or after point.
398 Otherwise `ispell-word' checks the preceding word."
400 :group 'ispell)
402 (defcustom ispell-help-in-bufferp nil
412 :group 'ispell)
414 (defcustom ispell-quietly nil
415 "*Non-nil means suppress messages in `ispell-word'."
417 :group 'ispell)
419 (defcustom ispell-format-word-function (function upcase)
423 :group 'ispell)
424 (defvaralias 'ispell-format-word 'ispell-format-word-function)
426 (defcustom ispell-use-framepop-p nil
427 "When non-nil ispell uses framepop to display choices in a dedicated frame.
432 :group 'ispell)
435 (defcustom ispell-personal-dictionary nil
441 :group 'ispell)
443 (defcustom ispell-silently-savep nil
446 :group 'ispell)
448 (defvar ispell-local-dictionary-overridden nil
450 (make-variable-buffer-local 'ispell-local-dictionary-overridden)
452 (defcustom ispell-local-dictionary nil
455 or nil, which means use the global setting in `ispell-dictionary'.
456 Dictionary names are defined in `ispell-local-dictionary-alist'
457 and `ispell-dictionary-alist',
459 Setting `ispell-local-dictionary' to a value has the same effect as
460 calling \\[ispell-change-dictionary] with that value. This variable
462 `ispell-dictionary-keyword' or the Local Variable syntax."
465 :group 'ispell)
466 ;;;###autoload(put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p)
468 (make-variable-buffer-local 'ispell-local-dictionary)
470 (defcustom ispell-extra-args nil
473 words as correct. See also `ispell-dictionary-alist', which may be used
476 :group 'ispell)
480 (defcustom ispell-skip-html 'use-mode-name
481 "*Indicates whether ispell should skip spell checking of SGML markup.
487 :group 'ispell)
489 (make-variable-buffer-local 'ispell-skip-html)
493 (defcustom ispell-local-dictionary-alist nil
495 These can override the values in `ispell-dictionary-alist'.
515 :group 'ispell)
523 ispell-dictionary-alist-1
547 ispell-dictionary-alist-2
568 ispell-dictionary-alist-3
591 ispell-dictionary-alist-4
615 ispell-dictionary-alist-5
636 ispell-dictionary-alist-6
662 (defvar ispell-dictionary-alist
663 (append ispell-dictionary-alist-1 ispell-dictionary-alist-2
664 ispell-dictionary-alist-3 ispell-dictionary-alist-4
665 ispell-dictionary-alist-5 ispell-dictionary-alist-6)
673 DICTIONARY-NAME is a possible string value of variable `ispell-dictionary',
700 ISPELL-ARGS is a list of additional arguments passed to the ispell
710 `ispell-parsing-keyword' for details on this.
718 (defvar ispell-really-aspell nil) ; Non-nil if aspell extensions should be used
720 (defvar ispell-aspell-supports-utf8 nil
722 This is set to t in `ispell-check-version' for aspell >= 0.60.
725 this would require some extra guessing in `ispell-aspell-find-dictionary'.")
730 ;;; The following are used by ispell, and should not be changed.
735 ;;; The version must be 3.1 or greater for this version of ispell.el
737 (defconst ispell-required-version '(3 1 12)
738 "Ispell versions with which this version of ispell.el is known to work.")
739 (defvar ispell-offset -1
740 "Offset that maps protocol differences between ispell 3.1 versions.")
742 (defconst ispell-version "ispell.el 3.6 - 7-Jan-2003")
745 (defun ispell-check-version (&optional interactivep)
746 "Ensure that `ispell-program-name' is valid and the correct version.
749 ;; This is a little wasteful as we actually launch ispell twice: once
765 (let ((buf (get-buffer " *ispell-tmp*")))
767 (set-buffer (get-buffer-create " *ispell-tmp*"))
769 (setq status (ispell-call-process
770 ispell-program-name nil t nil
775 (file-name-nondirectory ispell-program-name)))
780 ;; report version information of ispell and ispell.el
786 ispell-version))
793 (error "%s exited with %s %s" ispell-program-name
798 (format "%d" (car ispell-required-version))
804 (car (cdr ispell-required-version)))) ; minor version mismatch
806 ispell-program-name (car ispell-required-version)
807 (car (cdr ispell-required-version))
808 (car (cdr (cdr ispell-required-version))))
811 (car (cdr ispell-required-version)))
813 (car (cdr (cdr ispell-required-version)))))
814 (setq ispell-offset 0))
818 (setq ispell-really-aspell
822 (setq ispell-aspell-supports-utf8
828 (defun ispell-call-process (&rest args)
836 (defun ispell-call-process-region (&rest args)
852 (defvar ispell-menu-map nil "Key map for ispell menu.")
853 ;;; redo menu when loading ispell to get dictionary modifications
854 (setq ispell-menu-map nil)
857 (defvar ispell-menu-xemacs nil
867 (defvar ispell-menu-map-needed
869 (and (not ispell-menu-map)
873 (defvar ispell-library-directory (condition-case ()
874 (ispell-check-version)
876 "Directory where ispell dictionaries reside.")
878 (defvar ispell-process nil
881 (defvar ispell-async-processp (and (fboundp 'delete-process)
890 ;; Make ispell.el work better with aspell.
892 (defvar ispell-have-aspell-dictionaries nil
895 (defun ispell-maybe-find-aspell-dictionaries ()
897 (when (and (not ispell-have-aspell-dictionaries)
899 (progn (ispell-check-version) t)
901 ispell-really-aspell
902 ispell-aspell-supports-utf8)
903 (ispell-find-aspell-dictionaries)))
905 (defun ispell-find-aspell-dictionaries ()
906 "Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
907 (unless ispell-really-aspell
912 (ispell-call-process ispell-program-name nil t nil "dicts")
917 (mapcar #'ispell-aspell-find-dictionary dictionaries))))
920 (setq found (ispell-aspell-add-aliases found))
921 ;; Merge into FOUND any elements from the standard ispell-dictionary-alist
923 (dolist (dict ispell-dictionary-alist)
926 (setq ispell-dictionary-alist found)
928 (let* ((english-dict (assoc "en" ispell-dictionary-alist))
931 (cdr (car ispell-dictionary-alist-1))))))
932 (push default-dict ispell-dictionary-alist))
933 (setq ispell-have-aspell-dictionaries t)))
935 (defvar ispell-aspell-data-dir nil
938 (defvar ispell-aspell-dict-dir nil
941 (defun ispell-get-aspell-config-value (key)
945 (ispell-call-process ispell-program-name nil t nil "config" key)
948 (defun ispell-aspell-find-dictionary (dict-name)
956 (concat (or ispell-aspell-data-dir
957 (setq ispell-aspell-data-dir
958 (ispell-get-aspell-config-value "data-dir")))
993 (defun ispell-aspell-add-aliases (alist)
997 (concat (or ispell-aspell-dict-dir
998 (setq ispell-aspell-dict-dir
999 (ispell-get-aspell-config-value "dict-dir")))
1015 (defun ispell-valid-dictionary-list ()
1017 The variable `ispell-library-directory' defines the library location."
1019 (ispell-maybe-find-aspell-dictionaries)
1020 (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist))
1031 (or ispell-really-aspell
1032 (not ispell-library-directory)
1033 (file-exists-p (concat ispell-library-directory
1035 (file-exists-p (concat ispell-library-directory "/" name ".has"))
1037 (or (file-exists-p (concat ispell-library-directory
1039 (file-exists-p (concat ispell-library-directory
1046 (if ispell-menu-map-needed
1048 (setq ispell-menu-map (make-sparse-keymap "Spell"))
1049 (define-key ispell-menu-map [ispell-change-dictionary]
1050 '(menu-item "Change Dictionary..." ispell-change-dictionary
1052 (define-key ispell-menu-map [ispell-kill-ispell]
1053 '(menu-item "Kill Process" ispell-kill-ispell
1054 :enable (and (boundp 'ispell-process) ispell-process
1055 (eq (ispell-process-status) 'run))
1057 (define-key ispell-menu-map [ispell-pdict-save]
1059 (lambda () (interactive) (ispell-pdict-save t t))
1061 (define-key ispell-menu-map [ispell-customize]
1063 (lambda () (interactive) (customize-group 'ispell))
1065 (define-key ispell-menu-map [ispell-help]
1066 ;; use (x-popup-menu last-nonmenu-event(list "" ispell-help-list)) ?
1068 (lambda () (interactive) (describe-function 'ispell-help))
1070 (define-key ispell-menu-map [flyspell-mode]
1075 (define-key ispell-menu-map [ispell-complete-word]
1076 '(menu-item "Complete Word" ispell-complete-word
1078 (define-key ispell-menu-map [ispell-complete-word-interior-frag]
1079 '(menu-item "Complete Word Fragment" ispell-complete-word-interior-frag
1083 (if ispell-menu-map-needed
1085 (define-key ispell-menu-map [ispell-continue]
1086 '(menu-item "Continue Spell-Checking" ispell-continue
1087 :enable (and (boundp 'ispell-region-end)
1088 (marker-position ispell-region-end)
1089 (equal (marker-buffer ispell-region-end)
1092 (define-key ispell-menu-map [ispell-word]
1093 '(menu-item "Spell-Check Word" ispell-word
1095 (define-key ispell-menu-map [ispell-comments-and-strings]
1096 '(menu-item "Spell-Check Comments" ispell-comments-and-strings
1100 (if ispell-menu-map-needed
1102 (define-key ispell-menu-map [ispell-region]
1103 '(menu-item "Spell-Check Region" ispell-region
1106 (define-key ispell-menu-map [ispell-message]
1107 '(menu-item "Spell-Check Message" ispell-message
1110 (define-key ispell-menu-map [ispell-buffer]
1111 '(menu-item "Spell-Check Buffer" ispell-buffer
1113 ;;(put 'ispell-region 'menu-enable 'mark-active)
1114 (fset 'ispell-menu-map (symbol-value 'ispell-menu-map))))
1119 ;;(null ispell-menu-xemacs)
1121 (let ((dicts (if (fboundp 'ispell-valid-dictionary-list)
1122 (reverse (ispell-valid-dictionary-list))))
1125 '(["Help" (describe-function 'ispell-help) t]
1126 ;;["Help" (popup-menu ispell-help-list) t]
1127 ["Check Message" ispell-message t]
1128 ["Check Buffer" ispell-buffer t]
1129 ["Check Comments" ispell-comments-and-strings t]
1130 ["Check Word" ispell-word t]
1131 ["Check Region" ispell-region (or (not zmacs-regions) (mark))]
1132 ["Continue Check" ispell-continue t]
1133 ["Complete Word Frag"ispell-complete-word-interior-frag t]
1134 ["Complete Word" ispell-complete-word t]
1135 ["Kill Process" ispell-kill-ispell t]
1136 ["Customize..." (customize-group 'ispell) t]
1141 ["Save Personal Dict"(ispell-pdict-save t t) t]
1142 ["Change Dictionary" ispell-change-dictionary t])))
1150 (list 'ispell-change-dictionary name)
1152 (setq ispell-menu-xemacs menu)
1159 (add-menu '("Cmds") "Spell-Check" ispell-menu-xemacs))
1162 (add-menu '("Edit") "Spell" ispell-menu-xemacs))))))
1167 (fset 'ispell-int-char 'int-char)
1169 (fset 'ispell-int-char 'identity))
1175 ;;; This variable contains the current dictionary being used if the ispell
1177 (defvar ispell-current-dictionary nil
1179 This is passed to the ispell process using the `-d' switch and is
1180 used as key in `ispell-local-dictionary-alist' and `ispell-dictionary-alist'.")
1182 (defvar ispell-current-personal-dictionary nil
1184 This is passed to the ispell process using the `-p' switch.")
1186 (defvar ispell-dictionary nil
1187 "Default dictionary to use if `ispell-local-dictionary' is nil.")
1189 (defun ispell-decode-string (str)
1196 (ispell-get-coding-system))
1197 (decode-coding-string str (ispell-get-coding-system))
1200 (put 'ispell-unified-chars-table 'char-table-extra-slots 0)
1206 (defconst ispell-unified-chars-table
1207 (let ((table (make-char-table 'ispell-unified-chars-table)))
1222 (defun ispell-get-decoded-string (n)
1224 (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1225 (assoc ispell-current-dictionary ispell-dictionary-alist)))
1229 (setq str (ispell-decode-string str))
1238 (aref ispell-unified-chars-table unichar)
1244 (defun ispell-get-casechars ()
1245 (ispell-get-decoded-string 1))
1246 (defun ispell-get-not-casechars ()
1247 (ispell-get-decoded-string 2))
1248 (defun ispell-get-otherchars ()
1249 (ispell-get-decoded-string 3))
1250 (defun ispell-get-many-otherchars-p ()
1251 (nth 4 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1252 (assoc ispell-current-dictionary ispell-dictionary-alist))))
1253 (defun ispell-get-ispell-args ()
1254 (nth 5 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1255 (assoc ispell-current-dictionary ispell-dictionary-alist))))
1256 (defun ispell-get-extended-character-mode ()
1257 (nth 6 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1258 (assoc ispell-current-dictionary ispell-dictionary-alist))))
1259 (defun ispell-get-coding-system ()
1260 (nth 7 (or (assoc ispell-current-dictionary ispell-local-dictionary-alist)
1261 (assoc ispell-current-dictionary ispell-dictionary-alist))))
1264 (defvar ispell-pdict-modified-p nil
1270 (defvar ispell-quit nil)
1272 (defvar ispell-process-directory nil
1273 "The directory where `ispell-process' was started.")
1275 (defvar ispell-filter nil
1278 (defvar ispell-filter-continue nil
1281 (defvar ispell-output-buffer nil
1284 (defvar ispell-session-buffer nil
1287 (defvar ispell-cmd-args nil
1290 (defvar ispell-query-replace-marker (make-marker)
1293 (defvar ispell-recursive-edit-marker (make-marker)
1296 (defvar ispell-checking-message nil
1300 (defconst ispell-choices-buffer "*Choices*")
1302 (defvar ispell-overlay nil "Overlay variable for Ispell highlighting.")
1306 (defconst ispell-words-keyword "LocalWords: "
1311 (defconst ispell-dictionary-keyword "Local IspellDict: "
1314 `ispell-local-dictionary-alist' or `ispell-dictionary-alist'.
1318 (defconst ispell-pdict-keyword "Local IspellPersDict: "
1323 (defconst ispell-parsing-keyword "Local IspellParsing: "
1333 (defvar ispell-skip-region-alist
1334 '((ispell-words-keyword forward-line)
1335 (ispell-dictionary-keyword forward-line)
1336 (ispell-pdict-keyword forward-line)
1337 (ispell-parsing-keyword forward-line)
1365 (put 'ispell-skip-region-alist 'risky-local-variable t)
1369 (defvar ispell-tex-skip-alists
1373 ;; \label, \nocite, \rule (in ispell - rest included here)
1374 ("\\\\addcontentsline" ispell-tex-arg-end 2)
1375 ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end)
1376 ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end)
1377 ;;("\\\\author" ispell-tex-arg-end)
1378 ("\\\\bibliographystyle" ispell-tex-arg-end)
1379 ("\\\\makebox" ispell-tex-arg-end 0)
1380 ("\\\\e?psfig" ispell-tex-arg-end)
1383 (;; delimited with \begin. In ispell: displaymath, eqnarray, eqnarray*,
1384 ;; equation, minipage, picture, tabular, tabular* (ispell)
1385 ("\\(figure\\|table\\)\\*?" ispell-tex-arg-end 0)
1386 ("list" ispell-tex-arg-end 2)
1395 (put 'ispell-tex-skip-alist 'risky-local-variable t)
1399 (defvar ispell-html-skip-alists
1409 Same format as `ispell-skip-region-alist'
1412 (put 'ispell-html-skip-alists 'risky-local-variable t)
1414 (defvar ispell-local-pdict ispell-personal-dictionary
1420 to calling \\[ispell-change-dictionary]. This variable is automatically
1421 set when defined in the file with either `ispell-pdict-keyword' or the
1424 (make-variable-buffer-local 'ispell-local-pdict)
1426 (defvar ispell-buffer-local-name nil
1430 (defvar ispell-parser 'use-mode-name
1431 "*Indicates whether ispell should parse the current buffer as TeX Code.
1438 \(add-hook 'tex-mode-hook (lambda () (setq ispell-parser 'tex)))")
1440 (defvar ispell-region-end (make-marker)
1443 (defvar ispell-check-only nil
1444 "If non-nil, `ispell-word' does not try to correct the word.")
1452 ;;;###autoload (define-key esc-map "$" 'ispell-word)
1455 (defun ispell-accept-output (&optional timeout-secs timeout-msecs)
1456 "Wait for output from ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
1457 If asynchronous subprocesses are not supported, call `ispell-filter' and
1458 pass it the output of the last ispell invocation."
1459 (if ispell-async-processp
1460 (accept-process-output ispell-process timeout-secs timeout-msecs)
1461 (if (null ispell-process)
1463 (let ((buf ispell-output-buffer)
1464 ispell-output)
1466 (setq ispell-filter nil)
1469 (setq ispell-output (buffer-substring-no-properties
1471 (ispell-filter t ispell-output)
1476 (defun ispell-send-replacement (misspelled replacement)
1479 (and ispell-really-aspell
1480 (ispell-send-string (concat "$$ra " misspelled "," replacement "\n"))))
1483 (defun ispell-send-string (string)
1485 (if ispell-async-processp
1486 (process-send-string ispell-process string)
1497 (session-buf ispell-session-buffer)
1498 (output-buf ispell-output-buffer)
1499 (ispell-args ispell-cmd-args)
1500 (defdir ispell-process-directory)
1511 (setq coding-system-for-read (ispell-get-coding-system)
1512 coding-system-for-write (ispell-get-coding-system)))
1517 (apply 'ispell-call-process-region
1519 ispell-program-name nil
1521 "-a" "-m" ispell-args))
1532 ;; `ispell-filter'.
1562 (defun ispell-insert-word (word)
1569 (defun ispell-word (&optional following quietly continue)
1574 If optional argument FOLLOWING is non-nil or if `ispell-following-word'
1577 When the optional argument QUIETLY is non-nil or `ispell-quietly' is non-nil
1584 which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'.
1586 This will check or reload the dictionary. Use \\[ispell-change-dictionary]
1587 or \\[ispell-region] to update the Ispell process.
1596 (interactive (list ispell-following-word ispell-quietly current-prefix-arg))
1598 (ispell-continue)
1599 (ispell-maybe-find-aspell-dictionaries)
1600 (ispell-accept-buffer-local-defs) ; use the correct dictionary
1602 (word (ispell-get-word following))
1613 (funcall ispell-format-word-function word)))
1614 (ispell-send-string "%\n") ; put in verbose mode
1615 (ispell-send-string (concat "^" word "\n"))
1616 ;; wait until ispell has processed word
1618 (ispell-accept-output)
1619 (not (string= "" (car ispell-filter)))))
1620 ;;(ispell-send-string "!\n") ;back to terse mode.
1621 (setq ispell-filter (cdr ispell-filter)) ; remove extra \n
1622 (if (and ispell-filter (listp ispell-filter))
1623 (if (> (length ispell-filter) 1)
1625 (setq poss (ispell-parse-output (car ispell-filter)))))
1629 (funcall ispell-format-word-function word)))
1637 (funcall ispell-format-word-function word)
1638 (funcall ispell-format-word-function poss)))
1643 ((null poss) (message "Error in ispell process"))
1644 (ispell-check-only ; called from ispell minor mode.
1648 (set-extent-property ext 'face ispell-highlight-face)
1652 (funcall ispell-format-word-function word))))
1655 (setq replace (ispell-command-loop
1660 (ispell-add-per-file-word-list (car poss)))
1671 (ispell-insert-word new-word)
1684 (setq ispell-quit (not (ispell-region start end)))
1687 (if (get-buffer ispell-choices-buffer)
1688 (kill-buffer ispell-choices-buffer))))
1689 (ispell-pdict-save ispell-silently-savep)
1690 ;; NB: Cancels ispell-quit incorrectly if called from ispell-region
1691 (if ispell-quit (setq ispell-quit nil replace 'quit))
1696 (defun ispell-get-word (following &optional extra-otherchars)
1697 "Return the word for spell-checking according to ispell syntax.
1698 If optional argument FOLLOWING is non-nil or if `ispell-following-word'
1705 which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'."
1706 (let* ((ispell-casechars (ispell-get-casechars))
1707 (ispell-not-casechars (ispell-get-not-casechars))
1708 (ispell-otherchars (ispell-get-otherchars))
1709 (ispell-many-otherchars-p (ispell-get-many-otherchars-p))
1710 (word-regexp (concat ispell-casechars
1712 (if (not (string= "" ispell-otherchars))
1713 (concat ispell-otherchars "?"))
1716 ispell-casechars
1718 (if (or ispell-many-otherchars-p
1724 (if (not (looking-at ispell-casechars))
1726 (re-search-forward ispell-casechars (point-max) t)
1727 (re-search-backward ispell-casechars (point-min) t)))
1729 (re-search-backward ispell-not-casechars (point-min) 'start)
1730 (while (and (or (and (not (string= "" ispell-otherchars))
1731 (looking-at ispell-otherchars))
1735 ispell-many-otherchars-p)
1740 (if (looking-at ispell-casechars)
1741 (re-search-backward ispell-not-casechars (point-min) 'move)))
1745 (if (looking-at ispell-casechars)
1746 (re-search-backward ispell-not-casechars (point-min) 'move)
1750 (if ispell-check-only
1760 ;;; Global ispell-pdict-modified-p is set by ispell-command-loop and
1766 (defun ispell-pdict-save (&optional no-query force-save)
1769 (interactive (list ispell-silently-savep t))
1770 (if (and ispell-pdict-modified-p (listp ispell-pdict-modified-p))
1771 (setq ispell-pdict-modified-p (car ispell-pdict-modified-p)))
1772 (if (or ispell-pdict-modified-p force-save)
1775 (ispell-send-string "#\n") ; save dictionary
1778 (setq ispell-pdict-modified-p nil))
1781 (defun ispell-command-loop (miss guess word start end)
1791 Global `ispell-pdict-modified-p' becomes a list where the only value
1794 Global `ispell-quit' set to start location to continue spell session."
1796 (line ispell-choices-win-default-height)
1798 (max-lines (- (ispell-adjusted-window-height) 4))
1801 ispell-choices-win-default-height))
1809 (set-buffer (get-buffer-create ispell-choices-buffer))
1812 " -- dict: " (or ispell-current-dictionary "default")
1813 " -- prog: " (file-name-nondirectory ispell-program-name)))
1847 (setq count (ispell-int-char (1+ count))
1851 count (ispell-int-char (1+ count))))
1852 (setq count (ispell-int-char (- count ?0 skipped))))
1865 (ispell-show-choices line end)
1871 (and ispell-highlight-p
1872 (ispell-highlight-spelling-error start end t))
1903 (ispell-send-string (concat "*" word "\n"))
1904 (setq ispell-pdict-modified-p '(t)) ; dictionary modified!
1907 (ispell-send-string (concat "@" word "\n"))
1908 (if (null ispell-pdict-modified-p)
1909 (setq ispell-pdict-modified-p
1910 (list ispell-pdict-modified-p)))
1911 (if (= char ?A) 0)) ; return 0 for ispell-add buffer-local
1913 (and (eq 'block ispell-highlight-p) ; refresh tty's
1914 (ispell-highlight-spelling-error start end nil t))
1916 (if (or (= char ?R) ispell-query-replace-choices)
1923 (and (eq 'block ispell-highlight-p)
1924 (ispell-highlight-spelling-error start end nil
1928 (and (eq 'block ispell-highlight-p)
1929 (ispell-highlight-spelling-error start end nil t))
1930 (ispell-help)
1931 (and (eq 'block ispell-highlight-p)
1932 (ispell-highlight-spelling-error start end nil
1937 (ispell-pdict-save ispell-silently-savep)
1939 (setq ispell-quit t)
1943 (ispell-pdict-save ispell-silently-savep)
1947 " use C-u \\[ispell-word] to resume")))
1948 (setq ispell-quit start)
1953 (ispell-kill-ispell t) ; terminate process.
1954 (setq ispell-quit (or (not ispell-checking-message)
1956 ispell-pdict-modified-p nil))
1959 (and (eq 'block ispell-highlight-p) ; refresh tty displays
1960 (ispell-highlight-spelling-error start end nil t))
1968 ispell-choices-buffer))
1975 ispell-alternate-dictionary)
1978 line ispell-choices-win-default-height)
1990 (setq count (ispell-int-char (1+ count))
1994 count (ispell-int-char (1+ count))))
1995 (setq count (ispell-int-char
1997 (ispell-show-choices line end)
1999 (and (eq 'block ispell-highlight-p)
2000 (ispell-highlight-spelling-error start end nil
2004 (ispell-send-string (concat "*" (downcase word) "\n"))
2005 (setq ispell-pdict-modified-p '(t)) ; dictionary modified!
2008 (ispell-send-string
2010 (setq ispell-pdict-modified-p '(t))
2013 (if ispell-query-replace-choices ; Query replace flag
2020 (if (marker-position ispell-recursive-edit-marker)
2025 (set-marker ispell-recursive-edit-marker start)
2026 ;;(set-marker ispell-region-end reg-end)
2027 (and ispell-highlight-p ; unhighlight
2028 (ispell-highlight-spelling-error start end))
2039 (goto-char ispell-recursive-edit-marker)
2041 ispell-recursive-edit-marker)
2044 (set-marker ispell-recursive-edit-marker nil)
2046 "Cannot continue ispell from this buffer.")))
2047 (set-marker ispell-recursive-edit-marker nil)))
2055 (and ispell-highlight-p ; unhighlight
2058 (ispell-highlight-spelling-error start end)))
2064 (defun ispell-show-choices (line end)
2066 (if (and ispell-use-framepop-p (fboundp 'framepop-display-buffer))
2068 (framepop-display-buffer (get-buffer ispell-choices-buffer))
2069 ;;; (get-buffer-window ispell-choices-buffer t)
2072 (let ((choices-window (get-buffer-window ispell-choices-buffer)))
2074 (if (= line (ispell-adjusted-window-height choices-window))
2079 (- line (ispell-adjusted-window-height choices-window)))
2081 (if (< line ispell-choices-win-default-height)
2083 (- ispell-choices-win-default-height
2093 (ispell-overlay-window (max line ispell-choices-win-default-height)))
2094 (switch-to-buffer ispell-choices-buffer)
2099 (defun ispell-help ()
2115 `q': Quit spelling session (Kills ispell process).
2123 (if (equal ispell-help-in-bufferp 'electric)
2133 ;; (- 15 (ispell-adjusted-window-height))))
2147 `q': Quit spelling session (Kills ispell process).
2162 "Type 'x C-h f ispell-help' for more help")))
2164 (if ispell-help-in-bufferp
2166 (ispell-overlay-window 4)
2186 Otherwise the variable `ispell-grep-command' contains the command used to
2190 `ispell-alternate-dictionary'."
2194 (setq lookup-dict ispell-alternate-dictionary))
2196 (let* ((process-connection-type ispell-use-ptys-p)
2198 (look-p (and ispell-look-p ; Only use look for an exact match.
2199 (or ispell-have-new-look (not wild-p))))
2200 (ispell-grep-buffer (get-buffer-create "*Ispell-Temp*")) ; result buf
2201 (prog (if look-p ispell-look-command ispell-grep-command))
2202 (args (if look-p ispell-look-options ispell-grep-options))
2207 (set-buffer ispell-grep-buffer)
2215 (setq status (apply 'ispell-call-process prog nil t nil
2239 (kill-buffer ispell-grep-buffer)
2241 (error "%s error: %s" ispell-grep-command (car results))))
2245 ;;; "ispell-filter" is a list of output lines from the generating function.
2250 ;;; "ispell-filter-continue" is true when we have received only part of a
2256 (defun ispell-filter (process output)
2257 "Output filter function for ispell, grep, and look."
2263 ;; If we get out of sync and ispell-filter-continue is asserted when we
2265 ;; ispell-filter-continue is asserted, ispell-filter *should* always be a
2269 (if (and ispell-filter-continue ispell-filter (listp ispell-filter))
2271 (setcar ispell-filter
2272 (concat (car ispell-filter) (substring output start end)))
2274 (setq ispell-filter
2275 (cons (substring output start end) ispell-filter)))
2278 (setq ispell-filter-continue t continue nil)
2280 (setq ispell-filter-continue nil end (1+ end))
2288 (defun ispell-highlight-spelling-error-generic (start end &optional highlight
2296 (and (eq 'block ispell-highlight-p)
2315 (and (eq 'block ispell-highlight-p)
2319 (ispell-highlight-spelling-error-generic
2323 (defun ispell-highlight-spelling-error-xemacs (start end &optional highlight)
2334 (defun ispell-highlight-spelling-error-overlay (start end &optional highlight)
2339 The variable `ispell-highlight-face' selects the face to use for highlighting."
2341 (if ispell-overlay
2342 (move-overlay ispell-overlay start end (current-buffer))
2343 (setq ispell-overlay (make-overlay start end))
2344 (overlay-put ispell-overlay 'priority 1001) ;higher than lazy overlays
2345 (overlay-put ispell-overlay 'face ispell-highlight-face))
2346 (if ispell-overlay
2347 (delete-overlay ispell-overlay)))
2348 (if (and ispell-lazy-highlight (boundp 'lazy-highlight-cleanup))
2364 (defun ispell-highlight-spelling-error (start end &optional highlight refresh)
2367 (ispell-highlight-spelling-error-xemacs start end highlight))
2371 (ispell-highlight-spelling-error-overlay start end highlight))
2372 (t (ispell-highlight-spelling-error-generic start end highlight refresh))))
2374 (defun ispell-adjusted-window-height (&optional window)
2389 (defun ispell-overlay-window (height)
2407 (let ((deficit (- height (ispell-adjusted-window-height))))
2419 (defun ispell-parse-output (output &optional accept-list shift)
2439 (ding) ; error message from ispell!
2475 (defun ispell-process-status ()
2478 (if ispell-async-processp
2479 (process-status ispell-process)
2480 (and ispell-process 'run)))
2483 (defun ispell-start-process ()
2484 "Start the ispell process, with support for no asynchronous processes.
2485 Keeps argument list for future ispell invocations for no async support."
2493 (setq ispell-current-dictionary
2494 (or ispell-local-dictionary ispell-dictionary))
2495 (setq ispell-current-personal-dictionary
2496 (or ispell-local-pdict ispell-personal-dictionary))
2497 (setq args (ispell-get-ispell-args))
2498 (if (and ispell-current-dictionary ; use specified dictionary
2501 (append (list "-d" ispell-current-dictionary) args)))
2502 (if ispell-current-personal-dictionary ; use specified pers dict
2506 (expand-file-name ispell-current-personal-dictionary)))))
2507 (setq args (append args ispell-extra-args))
2510 (setq ispell-buffer-local-name nil)
2512 (if ispell-async-processp
2513 (let ((process-connection-type ispell-use-ptys-p))
2515 "ispell" nil ispell-program-name
2519 (setq ispell-cmd-args args
2520 ispell-output-buffer (generate-new-buffer " *ispell-output*")
2521 ispell-session-buffer (generate-new-buffer " *ispell-session*"))
2522 (ispell-send-string "\032\n") ; so Ispell prints version and exits
2527 (defun ispell-init-process ()
2529 (if (and ispell-process
2530 (eq (ispell-process-status) 'run)
2533 (or (not ispell-personal-dictionary)
2534 (equal ispell-process-directory default-directory)))
2535 (setq ispell-filter nil ispell-filter-continue nil)
2537 (ispell-kill-ispell t)
2539 (or ispell-local-dictionary ispell-dictionary "default"))
2541 (setq ispell-library-directory (ispell-check-version)
2542 ispell-process-directory default-directory
2543 ispell-process (ispell-start-process)
2544 ispell-filter nil
2545 ispell-filter-continue nil)
2546 (if ispell-async-processp
2547 (set-process-filter ispell-process 'ispell-filter))
2553 (set-process-coding-system ispell-process (ispell-get-coding-system)
2554 (ispell-get-coding-system)))
2556 (ispell-accept-output 3)
2558 (if (null ispell-filter) (ispell-accept-output 3))
2559 (cond ((null ispell-filter)
2560 (error "%s did not output version line" ispell-program-name))
2562 (stringp (car ispell-filter))
2563 (if (string-match "warning: " (car ispell-filter))
2565 (ispell-accept-output 3) ; was warn msg.
2566 (stringp (car ispell-filter)))
2567 (null (cdr ispell-filter)))
2568 (string-match "^@(#) " (car ispell-filter)))
2577 (ispell-accept-output 3)
2578 (error "%s" (mapconcat 'identity ispell-filter "\n"))))
2579 (setq ispell-filter nil) ; Discard version ID line
2580 (let ((extended-char-mode (ispell-get-extended-character-mode)))
2582 (ispell-send-string (concat extended-char-mode "\n"))))
2583 (if ispell-async-processp
2584 (set-process-query-on-exit-flag ispell-process nil))))
2587 (defun ispell-kill-ispell (&optional no-error)
2593 (run-hooks 'ispell-kill-ispell-hook)
2594 (if (not (and ispell-process
2595 (eq (ispell-process-status) 'run)))
2597 (error "There is no ispell process running!"))
2598 (if ispell-async-processp
2599 (delete-process ispell-process)
2601 (ispell-send-string "\n") ; make sure side effects occurred.
2602 (kill-buffer ispell-output-buffer)
2603 (kill-buffer ispell-session-buffer)
2604 (setq ispell-output-buffer nil
2605 ispell-session-buffer nil))
2606 (setq ispell-process nil)
2611 ;;; ispell-change-dictionary is set in some people's hooks. Maybe this should
2612 ;;; call ispell-init-process rather than wait for a spell checking command?
2615 (defun ispell-change-dictionary (dict &optional arg)
2624 (and (fboundp 'ispell-valid-dictionary-list)
2625 (mapcar 'list (ispell-valid-dictionary-list)))
2628 (ispell-maybe-find-aspell-dictionaries)
2629 (unless arg (ispell-buffer-local-dict 'no-reload))
2633 (ispell-internal-change-dictionary)
2635 (or (and (not arg) ispell-local-dictionary)
2636 ispell-dictionary "default")))
2637 ((equal dict (or (and (not arg) ispell-local-dictionary)
2638 ispell-dictionary "default"))
2641 (ispell-internal-change-dictionary)
2645 (if (or (assoc dict ispell-local-dictionary-alist)
2646 (assoc dict ispell-dictionary-alist))
2649 (setq ispell-dictionary dict)
2651 (setq ispell-local-dictionary dict)
2652 (setq ispell-local-dictionary-overridden t))
2654 (ispell-internal-change-dictionary)
2659 (defun ispell-internal-change-dictionary ()
2663 (let ((dict (or ispell-local-dictionary ispell-dictionary))
2664 (pdict (or ispell-local-pdict ispell-personal-dictionary)))
2665 (unless (and (equal ispell-current-dictionary dict)
2666 (equal ispell-current-personal-dictionary pdict))
2667 (ispell-kill-ispell t)
2668 (setq ispell-current-dictionary dict
2669 ispell-current-personal-dictionary pdict))))
2671 ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
2674 (defun ispell-region (reg-start reg-end &optional recheckp shift)
2679 (ispell-maybe-find-aspell-dictionaries)
2681 (ispell-accept-buffer-local-defs)) ; set up dictionary, local words, etc.
2689 (file-name-nondirectory ispell-program-name)
2690 (or ispell-current-dictionary "default"))
2700 (if (re-search-forward (ispell-begin-skip-region-regexp) reg-end t)
2708 (file-name-nondirectory ispell-program-name)
2709 (or ispell-current-dictionary "default")))
2711 (set-marker ispell-region-end reg-end)
2712 (while (and (not ispell-quit)
2713 (< (point) ispell-region-end))
2727 ;; Can change skip-regexps (in ispell-message)
2728 (ispell-skip-region key) ; moves pt past region.
2732 (ispell-ignore-fcc skip-region-start
2734 (if (and (< rstart ispell-region-end)
2736 (ispell-begin-skip-region-regexp)
2737 ispell-region-end t))
2746 (min skip-region-start ispell-region-end)
2747 (marker-position ispell-region-end))))
2750 (string (ispell-get-line start end in-comment)))
2757 (setq shift (ispell-process-line string
2760 (if ispell-quit
2764 (if (and (not (and recheckp ispell-keep-choices-win))
2765 (get-buffer ispell-choices-buffer))
2766 (kill-buffer ispell-choices-buffer))
2769 (if ispell-quit
2771 ;; preserve or clear the region for ispell-continue.
2772 (if (not (numberp ispell-quit))
2773 (set-marker ispell-region-end nil)
2774 ;; Ispell-continue enabled - ispell-region-end is set.
2775 (goto-char ispell-quit))
2777 (if (and ispell-checking-message (numberp ispell-quit))
2779 (setq ispell-quit nil)
2781 (if (not recheckp) (setq ispell-quit nil)))
2782 (if (not recheckp) (set-marker ispell-region-end nil))
2784 (ispell-pdict-save ispell-silently-savep)
2786 (file-name-nondirectory ispell-program-name)
2787 (or ispell-current-dictionary "default"))))))
2790 (defun ispell-begin-skip-region-regexp ()
2792 Includes `ispell-skip-region-alist' plus tex, tib, html, and comment keys.
2793 Must call after `ispell-buffer-local-parsing' due to dependence on mode."
2795 (let ((skip-regexp (ispell-begin-skip-region ispell-skip-region-alist)))
2797 (if (and (null ispell-check-comments) comment-start)
2800 (if (and (eq 'exclusive ispell-check-comments) comment-start)
2806 (if ispell-skip-tib
2807 (setq skip-regexp (concat ispell-tib-ref-beginning "\\|" skip-regexp)))
2809 (if ispell-skip-html
2811 (ispell-begin-skip-region ispell-html-skip-alists)
2815 (if (eq ispell-parser 'tex)
2816 (setq skip-regexp (concat (ispell-begin-tex-skip-regexp) "\\|"
2819 (if (and ispell-checking-message
2820 (not (eq t ispell-checking-message)))
2823 ispell-checking-message
2832 (defun ispell-begin-skip-region (skip-alist)
2841 (defun ispell-begin-tex-skip-regexp ()
2843 Generated from `ispell-tex-skip-alists'."
2847 (car ispell-tex-skip-alists)
2855 (car (cdr ispell-tex-skip-alists))
2859 (defun ispell-skip-region-list ()
2861 Includes regions defined by `ispell-skip-region-alist', tex mode,
2862 `ispell-html-skip-alists', and `ispell-checking-message'.
2864 The list is of the form described by variable `ispell-skip-region-alist'.
2865 Must call after `ispell-buffer-local-parsing' due to dependence on mode."
2866 (let ((skip-alist ispell-skip-region-alist))
2868 (if (eq ispell-parser 'tex)
2870 skip-alist (append (car ispell-tex-skip-alists)
2871 (car (cdr ispell-tex-skip-alists))
2873 (if ispell-skip-html
2874 (setq skip-alist (append ispell-html-skip-alists skip-alist)))
2875 (if (and ispell-checking-message
2876 (not (eq t ispell-checking-message)))
2877 (setq skip-alist (append ispell-checking-message skip-alist)))
2881 (defun ispell-tex-arg-end (&optional arg)
2893 (defun ispell-ignore-fcc (start end)
2899 (if (and ispell-checking-message ispell-message-fcc-skip)
2900 (if (< ispell-message-fcc-skip (- end start))
2920 (defun ispell-skip-region (key)
2928 (alist (ispell-skip-region-list))
2932 ((and (null ispell-check-comments) comment-start
2936 (search-forward comment-end ispell-region-end t)))
2937 ((and (eq 'exclusive ispell-check-comments) comment-start
2939 (search-forward comment-start ispell-region-end :end))
2940 ((and ispell-skip-tib (string-match ispell-tib-ref-beginning key))
2941 (re-search-forward ispell-tib-ref-end ispell-region-end t))
2974 (defun ispell-get-line (start end in-comment)
2975 (let ((ispell-casechars (ispell-get-casechars))
2982 ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS
2992 (defun ispell-looking-at (string)
2993 (let ((coding (ispell-get-coding-system))
3005 (defun ispell-process-line (string shift)
3006 "Sends STRING, a line of text, to ispell and processes the result.
3015 (ispell-send-string string)
3017 (ispell-accept-output)
3019 (not (string= "" (car ispell-filter)))))
3022 (setq ispell-filter (nreverse (cdr ispell-filter)))
3023 (while (and (not ispell-quit) ispell-filter)
3025 (setq poss (ispell-parse-output (car ispell-filter)
3031 ;; end of region markers line-end and ispell-region-end
3033 (copy-marker (+ start ispell-offset (car (cdr poss)))))
3040 (ispell-horiz-scroll)
3042 (ispell-horiz-scroll)
3044 (ispell-horiz-scroll)
3048 (or (ispell-looking-at (car poss))
3053 ;; ispell-cmd-loop can go recursive & change buffer
3054 (if ispell-keep-choices-win
3055 (setq replace (ispell-command-loop
3061 (setq replace (ispell-command-loop
3071 (if (and (eq ispell-parser 'tex)
3078 (setq ispell-filter nil
3086 (ispell-add-per-file-word-list (car poss)))
3093 (ispell-insert-word replace) ; insert dictionary word
3094 (ispell-send-replacement (car poss) replace)
3099 (ispell-send-replacement (car poss) replace-word)
3111 (let ((region-end (copy-marker ispell-region-end)))
3112 (setq recheck-region ispell-filter
3113 ispell-filter nil ; save filter
3115 shift (ispell-region
3121 (set-marker ispell-region-end region-end)
3123 (setq ispell-filter recheck-region
3135 (if (not ispell-quit)
3138 (file-name-nondirectory ispell-program-name)
3139 (or ispell-current-dictionary "default"))))
3146 (if (= word-start ispell-region-end)
3147 (set-marker ispell-region-end (+ word-start word-len)))
3153 (setq ispell-filter (cdr ispell-filter)))
3158 (defun ispell-comments-and-strings ()
3174 (setq done (not (ispell-region start (point))))))))))
3178 (defun ispell-buffer ()
3181 (ispell-region (point-min) (point-max)))
3185 (defun ispell-continue ()
3188 (if (not (marker-position ispell-region-end))
3190 (if (not (equal (marker-buffer ispell-region-end) (current-buffer)))
3191 (message "Must continue ispell from buffer %s"
3192 (buffer-name (marker-buffer ispell-region-end)))
3193 (ispell-region
3195 (car (cdr (ispell-get-word t)))
3196 (marker-position ispell-region-end)))))
3200 (defun ispell-horiz-scroll ()
3215 (defun ispell-complete-word (&optional interior-frag)
3220 Standard ispell choices are then available."
3224 (word (ispell-get-word nil "\\*")) ; force "previous-word" processing.
3232 (if (or interior-frag (null ispell-look-p))
3234 ispell-complete-word-dict)))
3254 (ispell-command-loop possibilities nil word start end)))
3257 (ispell-add-per-file-word-list word))
3263 (ispell-insert-word word)
3267 (ispell-word nil t)))))
3268 (if (get-buffer ispell-choices-buffer)
3269 (kill-buffer ispell-choices-buffer))))
3270 (ispell-pdict-save ispell-silently-savep)
3275 (defun ispell-complete-word-interior-frag ()
3278 (ispell-complete-word t))
3282 (defun ispell ()
3288 looking for a dictionary, please see the distribution of the GNU ispell
3294 (ispell-region (region-beginning) (region-end))
3295 (ispell-buffer)))
3302 (defvar ispell-minor-mode nil
3304 ;; Variable indicating that ispell minor mode is active.
3305 (make-variable-buffer-local 'ispell-minor-mode)
3307 (or (assq 'ispell-minor-mode minor-mode-alist)
3309 (cons '(ispell-minor-mode " Spell") minor-mode-alist)))
3311 (defvar ispell-minor-keymap
3313 (define-key map " " 'ispell-minor-check)
3314 (define-key map "\r" 'ispell-minor-check)
3319 (assoc 'ispell-minor-mode minor-mode-map-alist)
3321 (cons (cons 'ispell-minor-mode ispell-minor-keymap)
3325 (defun ispell-minor-mode (&optional arg)
3333 them into the running ispell process, type \\[ispell-word] SPC."
3335 (setq ispell-minor-mode
3336 (not (or (and (null arg) ispell-minor-mode)
3340 (defun ispell-minor-check ()
3345 (let ((ispell-minor-mode nil)
3346 (ispell-check-only t)
3350 (and ispell-skip-html (eq last-char ?>))
3351 (and ispell-skip-html (eq last-char ?\;))))
3352 (ispell-word nil t))))
3359 (defvar ispell-message-text-end
3379 "*End of text which will be checked in `ispell-message'.
3382 (put 'ispell-message-text-end 'risky-local-variable t)
3385 (defun ispell-mime-multipartp (&optional limit)
3409 (defun ispell-mime-skip-part (boundary)
3417 This places new MIME boundaries into variable `ispell-checking-message'."
3423 ispell-skip-html nil)
3430 (setq ispell-skip-html t))
3446 (let ((new-boundary (ispell-mime-multipartp)))
3452 (setq ispell-checking-message
3454 (list new-boundary 'ispell-mime-skip-part new-boundary)
3455 (if (eq t ispell-checking-message) nil
3456 ispell-checking-message))
3478 (defun ispell-message ()
3489 (add-hook 'message-send-hook 'ispell-message) ;; GNUS 5
3490 (add-hook 'news-inews-hook 'ispell-message) ;; GNUS 4
3491 (add-hook 'mail-send-hook 'ispell-message)
3492 (add-hook 'mh-before-send-letter-hook 'ispell-message)
3496 (function (lambda () (local-set-key \"\\C-ci\" 'ispell-message)))"
3501 (ispell-skip-region-alist-save ispell-skip-region-alist)
3514 ((not ispell-message-text-end) (point-max))
3515 ((char-or-string-p ispell-message-text-end)
3516 (if (re-search-forward ispell-message-text-end nil t)
3519 (t (min (point-max) (funcall ispell-message-text-end))))))
3522 (ispell-non-empty-string mail-yank-prefix)
3529 (ispell-non-empty-string sc-reference-tag-string))))
3533 (ispell-non-empty-string sc-reference-tag-string))))
3544 (ispell-non-empty-string mh-ins-buf-prefix))))
3551 (ispell-non-empty-string vm-included-text-prefix)))
3553 (ispell-skip-region-alist
3556 ispell-skip-region-alist))
3558 (dictionary-alist ispell-message-dictionary-alist)
3559 (ispell-checking-message t))
3562 (or (local-variable-p 'ispell-local-dictionary (current-buffer))
3567 (setq ispell-local-dictionary (cdr (car dictionary-alist))
3585 (ispell-region (point)
3594 (setq boundary (ispell-mime-multipartp end-of-headers))))
3605 (let (skip-regexp) ; protect from `ispell-mime-skip-part'
3609 (ispell-mime-skip-part nil)
3618 (setq ispell-checking-message
3619 (list (list boundary 'ispell-mime-skip-part boundary))))
3620 (ispell-region (point) limit))
3623 (setq ispell-skip-region-alist ispell-skip-region-alist-save
3624 ispell-skip-html nil
3628 (defun ispell-non-empty-string (string)
3639 (defun ispell-accept-buffer-local-defs ()
3641 (ispell-buffer-local-dict) ; May kill ispell-process.
3642 (ispell-buffer-local-words) ; Will initialize ispell-process.
3643 (ispell-buffer-local-parsing))
3646 (defun ispell-buffer-local-parsing ()
3650 ;; (ispell-init-process) must already be called.
3651 (ispell-send-string "!\n") ; Put process in terse mode.
3654 (if (and (not (eq 'exclusive ispell-check-comments))
3655 (or (and (eq ispell-parser 'use-mode-name)
3658 (eq ispell-parser 'tex)))
3660 (ispell-send-string "+\n") ; set ispell mode to tex
3661 (if (not (eq ispell-parser 'tex))
3662 (set (make-local-variable 'ispell-parser) 'tex)))
3663 (ispell-send-string "-\n")) ; set mode to normal (nroff)
3665 (if (and ispell-skip-html (not (eq ispell-skip-html t)))
3666 (setq ispell-skip-html
3670 (let ((extended-char-mode (ispell-get-extended-character-mode)))
3672 (ispell-send-string (concat extended-char-mode "\n"))))
3676 ;; Uses last occurrence of ispell-parsing-keyword
3677 (if (search-backward ispell-parsing-keyword nil t)
3680 (search-forward ispell-parsing-keyword)
3685 (not (eq 'exclusive ispell-check-comments)))
3686 (ispell-send-string "+\n~tex\n"))
3688 (ispell-send-string "-\n~nroff\n"))
3690 (ispell-send-string (concat string "\n")))
3695 ;;; Can kill the current ispell process
3697 (defun ispell-buffer-local-dict (&optional no-reload)
3701 `ispell-dictionary-keyword'), it will override the local setting
3702 from \\[ispell-change-dictionary].
3708 ;; Uses last occurrence of ispell-dictionary-keyword.
3710 (unless ispell-local-dictionary-overridden
3711 (if (search-backward ispell-dictionary-keyword nil t)
3713 (search-forward ispell-dictionary-keyword)
3716 (setq ispell-local-dictionary
3719 (if (search-backward ispell-pdict-keyword nil t)
3721 (search-forward ispell-pdict-keyword)
3724 (setq ispell-local-pdict
3728 (ispell-internal-change-dictionary)))
3731 (defun ispell-buffer-local-words ()
3733 ;; If there's an existing ispell process that's wrong for this use,
3735 (if (and ispell-buffer-local-name
3736 (not (equal ispell-buffer-local-name (buffer-name))))
3737 (ispell-kill-ispell t))
3738 ;; Actually start a new ispell process, because we need
3740 (ispell-init-process)
3743 (while (search-forward ispell-words-keyword nil t)
3744 (or ispell-buffer-local-name
3745 (setq ispell-buffer-local-name (buffer-name)))
3747 (ispell-casechars (ispell-get-casechars))
3754 ;; Error handling needs to be added between ispell and emacs.
3756 (equal 0 (string-match ispell-casechars string)))
3757 (ispell-send-string (concat "@" string "\n"))))))))
3762 (defun ispell-add-per-file-word-list (word)
3764 (or ispell-buffer-local-name
3765 (setq ispell-buffer-local-name (buffer-name)))
3772 search (search-forward ispell-words-keyword nil 'move)
3786 (insert (concat comment-start " " ispell-words-keyword))
3795 (provide 'ispell)
3812 ;;; ispell-check-comments: exclusive
3813 ;;; ispell-local-dictionary: "american"
3823 ;;; The following were automatically generated by ispell using the 'A' command:
3834 ;;; ispell.el ends here