summaryrefslogtreecommitdiff
path: root/lisp/textmodes/ispell.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/ispell.el')
-rw-r--r--lisp/textmodes/ispell.el148
1 files changed, 52 insertions, 96 deletions
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index ea46270508e..67852998f42 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -131,8 +131,7 @@
(defcustom ispell-highlight-p 'block
"Highlight spelling errors when non-nil.
When set to `block', assumes a block cursor with TTY displays."
- :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t)))
(defcustom ispell-lazy-highlight (boundp 'lazy-highlight-cleanup)
"Controls the lazy-highlighting of spelling errors.
@@ -141,7 +140,6 @@ error is highlighted lazily using isearch lazy highlighting (see
`lazy-highlight-initial-delay' and `lazy-highlight-interval')."
:type 'boolean
:group 'lazy-highlight
- :group 'ispell
:version "22.1")
(defcustom ispell-highlight-face (if ispell-lazy-highlight 'isearch 'highlight)
@@ -149,16 +147,14 @@ error is highlighted lazily using isearch lazy highlighting (see
This variable can be set by the user to whatever face they desire.
It's most convenient if the cursor color and highlight color are
slightly different."
- :type 'face
- :group 'ispell)
+ :type 'face)
(defcustom ispell-check-comments t
"Spelling of comments checked when non-nil.
When set to `exclusive', ONLY comments are checked. (For code comments).
Warning! Not checking comments, when a comment start is embedded in strings,
may produce undesired results."
- :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const exclusive) (const :tag "off" nil) (const :tag "on" t)))
;;;###autoload
(put 'ispell-check-comments 'safe-local-variable
(lambda (a) (memq a '(nil t exclusive))))
@@ -166,8 +162,7 @@ may produce undesired results."
(defcustom ispell-query-replace-choices nil
"Corrections made throughout region when non-nil.
Uses `query-replace' (\\[query-replace]) for corrections."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-skip-tib nil
"Does not spell check `tib' bibliography references when non-nil.
@@ -177,8 +172,7 @@ Skips any text between strings matching regular expressions
TeX users beware: Any text between [. and .] will be skipped -- even if
that's your whole buffer -- unless you set `ispell-skip-tib' to nil.
That includes the [.5mm] type of number..."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defvar ispell-tib-ref-beginning "[[<]\\."
"Regexp matching the beginning of a Tib reference.")
@@ -189,14 +183,12 @@ That includes the [.5mm] type of number..."
(defcustom ispell-keep-choices-win t
"If non-nil, keep the `*Choices*' window for the entire spelling session.
This minimizes redisplay thrashing."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-choices-win-default-height 2
"The default size of the `*Choices*' window, including the mode line.
Must be greater than 1."
- :type 'integer
- :group 'ispell)
+ :type 'integer)
(defcustom ispell-program-name
(or (executable-find "aspell")
@@ -211,8 +203,7 @@ Must be greater than 1."
:set (lambda (symbol value)
(set-default symbol value)
(if (featurep 'ispell)
- (ispell-set-spellchecker-params)))
- :group 'ispell)
+ (ispell-set-spellchecker-params))))
(defcustom ispell-alternate-dictionary
(cond ((file-readable-p "/usr/dict/web2") "/usr/dict/web2")
@@ -224,14 +215,12 @@ Must be greater than 1."
"/usr/share/lib/dict/words")
((file-readable-p "/sys/dict") "/sys/dict"))
"Alternate plain word-list dictionary for spelling help."
- :type '(choice file (const :tag "None" nil))
- :group 'ispell)
+ :type '(choice file (const :tag "None" nil)))
(defcustom ispell-complete-word-dict nil
"Plain word-list dictionary used for word completion if
different from `ispell-alternate-dictionary'."
- :type '(choice file (const :tag "None" nil))
- :group 'ispell)
+ :type '(choice file (const :tag "None" nil)))
(defcustom ispell-message-dictionary-alist nil
"List used by `ispell-message' to select a new dictionary.
@@ -241,29 +230,25 @@ DICTIONARY if `ispell-local-dictionary' is not buffer-local.
E.g. you may use the following value:
((\"^Newsgroups:[ \\t]*de\\\\.\" . \"deutsch8\")
(\"^To:[^\\n,]+\\\\.de[ \\t\\n,>]\" . \"deutsch8\"))"
- :type '(repeat (cons regexp string))
- :group 'ispell)
+ :type '(repeat (cons regexp string)))
(defcustom ispell-message-fcc-skip 50000
"Query before saving Fcc message copy if attachment larger than this value.
Always stores Fcc copy of message when nil."
- :type '(choice integer (const :tag "off" nil))
- :group 'ispell)
+ :type '(choice integer (const :tag "off" nil)))
(defcustom ispell-grep-command
"grep"
"Name of the grep command for search processes."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-grep-options
"-Ei"
"String of options to use when running the program in `ispell-grep-command'.
Should probably be \"-Ei\"."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-look-command
(cond ((file-exists-p "/bin/look") "/bin/look")
@@ -272,36 +257,30 @@ Should probably be \"-Ei\"."
(t "look"))
"Name of the look command for search processes.
This must be an absolute file name."
- :type 'file
- :group 'ispell)
+ :type 'file)
(defcustom ispell-look-p (file-exists-p ispell-look-command)
"Non-nil means use `look' rather than `grep'.
Default is based on whether `look' seems to be available."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-have-new-look nil
"Non-nil means use the `-r' option (regexp) when running `look'."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-look-options (if ispell-have-new-look "-dfr" "-df")
"String of command options for `ispell-look-command'."
- :type 'string
- :group 'ispell)
+ :type 'string)
(defcustom ispell-use-ptys-p nil
"When non-nil, Emacs uses ptys to communicate with Ispell.
When nil, Emacs uses pipes."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-following-word nil
"Non-nil means `ispell-word' checks the word around or after point.
Otherwise `ispell-word' checks the preceding word."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defcustom ispell-help-in-bufferp nil
"Non-nil means display interactive keymap help in a buffer.
@@ -312,21 +291,18 @@ The following values are supported:
for a couple of seconds.
electric Pop up a new buffer and display a long help message there.
User can browse and then exit the help mode."
- :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t))
- :group 'ispell)
+ :type '(choice (const electric) (const :tag "off" nil) (const :tag "on" t)))
(defcustom ispell-quietly nil
"Non-nil means suppress messages in `ispell-word'."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defvaralias 'ispell-format-word 'ispell-format-word-function)
(defcustom ispell-format-word-function (function upcase)
"Formatting function for displaying word being spell checked.
The function must take one string argument and return a string."
- :type 'function
- :group 'ispell)
+ :type 'function)
;; FIXME framepop.el last updated c 2003 (?),
;; use posframe.
@@ -335,21 +311,18 @@ The function must take one string argument and return a string."
You can set this variable to dynamically use framepop if you are in a
window system by evaluating the following on startup to set this variable:
(and (display-graphic-p) (require \\='framepop nil t))"
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
;;;###autoload
(defcustom ispell-personal-dictionary nil
"File name of your personal spelling dictionary, or nil.
If nil, the default personal dictionary for your spelling checker is used."
:type '(choice file
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
(defcustom ispell-silently-savep nil
"When non-nil, save personal dictionary without asking for confirmation."
- :type 'boolean
- :group 'ispell)
+ :type 'boolean)
(defvar-local ispell-local-dictionary-overridden nil
"Non-nil means the user has explicitly set this buffer's Ispell dictionary.")
@@ -366,8 +339,7 @@ calling \\[ispell-change-dictionary] with that value. This variable
is automatically set when defined in the file with either
`ispell-dictionary-keyword' or the Local Variable syntax."
:type '(choice string
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
;;;###autoload
(put 'ispell-local-dictionary 'safe-local-variable 'string-or-null-p)
@@ -376,16 +348,14 @@ is automatically set when defined in the file with either
(defcustom ispell-dictionary nil
"Default dictionary to use if `ispell-local-dictionary' is nil."
:type '(choice string
- (const :tag "default" nil))
- :group 'ispell)
+ (const :tag "default" nil)))
(defcustom ispell-extra-args nil
"If non-nil, a list of extra switches to pass to the Ispell program.
For example, (\"-W\" \"3\") to cause it to accept all 1-3 character
words as correct. See also `ispell-dictionary-alist', which may be used
for language-specific arguments."
- :type '(repeat string)
- :group 'ispell)
+ :type '(repeat string))
@@ -400,8 +370,7 @@ such as \"&amp;\". See `ispell-html-skip-alists' for more details.
This variable affects spell-checking of HTML, XML, and SGML files."
:type '(choice (const :tag "always" t) (const :tag "never" nil)
- (const :tag "use-mode-name" use-mode-name))
- :group 'ispell)
+ (const :tag "use-mode-name" use-mode-name)))
(make-variable-buffer-local 'ispell-skip-html)
@@ -427,8 +396,7 @@ re-start Emacs."
(const "~nroff") (const "~list")
(const "~latin1") (const "~latin3")
(const :tag "default" nil))
- (coding-system :tag "Coding System")))
- :group 'ispell)
+ (coding-system :tag "Coding System"))))
(defvar ispell-dictionary-base-alist
@@ -681,11 +649,7 @@ Otherwise returns the library directory name, if that is defined."
result libvar status ispell-program-version)
(with-temp-buffer
- (setq status (ispell-call-process
- ispell-program-name nil t nil
- (let ((case-fold-search
- (memq system-type '(ms-dos windows-nt))))
- "-vv")))
+ (setq status (ispell-call-process ispell-program-name nil t nil "-vv"))
(goto-char (point-min))
(if interactivep
;; Report version information of ispell
@@ -1108,7 +1072,7 @@ dictionary from that list was found."
(split-string
(with-temp-buffer
(ispell-call-process ispell-program-name
- null-device
+ nil
t
nil
"-D"
@@ -1239,22 +1203,11 @@ If LANG is omitted, get the extra word characters for the default language."
(split-string
(ispell--call-enchant-lsmod "-list-dicts") " ([^)]+)\n" t))
(found
- (mapcar #'(lambda (lang)
- `(,lang "[[:alpha:]]" "[^[:alpha:]]"
- ,(ispell--get-extra-word-characters lang) t nil nil utf-8))
+ (mapcar (lambda (lang)
+ `(,lang "[[:alpha:]]" "[^[:alpha:]]"
+ ,(ispell--get-extra-word-characters lang) t nil nil utf-8))
dictionaries)))
- ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist
- ;; which have no element in FOUND at all.
- (dolist (dict ispell-dictionary-base-alist)
- (unless (assoc (car dict) found)
- (setq found (nconc found (list dict)))))
- (setq ispell-enchant-dictionary-alist found)
- ;; Add a default entry
- (let ((default-dict
- `(nil "[[:alpha:]]" "[^[:alpha:]]"
- ,(ispell--get-extra-word-characters)
- t nil nil utf-8)))
- (push default-dict ispell-enchant-dictionary-alist))))
+ (setq ispell-enchant-dictionary-alist found)))
;; Set params according to the selected spellchecker
@@ -1277,7 +1230,7 @@ aspell is used along with Emacs).")
(defun ispell-set-spellchecker-params ()
"Initialize some spellchecker parameters when changed or first used."
- (unless (eq ispell-last-program-name ispell-program-name)
+ (unless (equal ispell-last-program-name ispell-program-name)
(ispell-kill-ispell t)
(if (and (condition-case ()
(progn
@@ -1797,10 +1750,12 @@ You can set this variable in hooks in your init file -- eg:
If asynchronous subprocesses are not supported, call function `ispell-filter'
and pass it the output of the last Ispell invocation."
(if ispell-async-processp
- (let ((timeout (if timeout-msecs
- (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
- timeout-secs)))
- (accept-process-output ispell-process timeout))
+ (if (process-live-p ispell-process)
+ (let ((timeout (if timeout-msecs
+ (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+ timeout-secs)))
+ (accept-process-output ispell-process timeout))
+ (error "No Ispell process to read output from!"))
(if (null ispell-process)
(error "No Ispell process to read output from!")
(let ((buf ispell-output-buffer)
@@ -1825,7 +1780,8 @@ Only works for Aspell and Enchant."
(defun ispell-send-string (string)
"Send the string STRING to the Ispell process."
(if ispell-async-processp
- (process-send-string ispell-process string)
+ (if (process-live-p ispell-process)
+ (process-send-string ispell-process string))
;; Asynchronous subprocesses aren't supported on this losing system.
;; We keep all the directives passed to Ispell during the entire
;; session in a buffer, and pass them anew each time we invoke
@@ -2541,7 +2497,7 @@ if defined."
"Customize `ispell-alternate-dictionary' to set yours.")))
(let* ((process-connection-type ispell-use-ptys-p)
- (wild-p (string-match "\\*" word))
+ (wild-p (string-search "*" word))
(look-p (and ispell-look-p ; Only use look for an exact match.
(or ispell-have-new-look (not wild-p))))
(prog (if look-p ispell-look-command ispell-grep-command))
@@ -2604,7 +2560,7 @@ if defined."
(continue t)
end)
(while continue
- (setq end (string-match "\n" output start)) ; get text up to the newline.
+ (setq end (string-search "\n" output start)) ; get text up to the newline.
;; If we get out of sync and ispell-filter-continue is asserted when we
;; are not continuing, treat the next item as a separate list. When
;; ispell-filter-continue is asserted, ispell-filter *should* always be a
@@ -2776,11 +2732,11 @@ Optional third arg SHIFT is an offset to apply based on previous corrections."
(if (eq type ?#)
(setq count 0) ; no misses for type #
(setq count (string-to-number output) ; get number of misses.
- output (substring output (1+ (string-match " " output 1)))))
+ output (substring output (1+ (string-search " " output 1)))))
(setq offset (string-to-number output))
(setq output (if (eq type ?#) ; No miss or guess list.
nil
- (substring output (1+ (string-match " " output 1)))))
+ (substring output (1+ (string-search " " output 1)))))
(while output
(let ((end (string-match ", \\|\\($\\)" output))) ; end of miss/guess.
(setq cur-count (1+ cur-count))
@@ -3776,7 +3732,7 @@ SPC.
For spell-checking \"on the fly\", not just after typing SPC or
RET, use `flyspell-mode'."
- nil " Spell" ispell-minor-keymap)
+ :lighter " Spell" :keymap ispell-minor-keymap)
(defun ispell-minor-check ()
"Check previous word, then continue with the normal binding of this key.
@@ -4121,7 +4077,7 @@ Includes LaTeX/Nroff modes and extended character mode."
(ispell-send-string "+\n~tex\n"))
((string-match "nroff-mode" string)
(ispell-send-string "-\n~nroff\n"))
- ((string-match "~" string) ; Set extended character mode.
+ ((string-search "~" string) ; Set extended character mode.
(ispell-send-string (concat string "\n")))
(t (message "Invalid Ispell Parsing argument!")
(sit-for 2))))))))