(extent-at start)
(and (fboundp 'delete-extent)
(delete-extent (extent-at start)))))
- ((null poss) (message "Error in ispell process"))
+ ((null poss)
+ (message "Error checking word %s using %s with %s dictionary"
+ (funcall ispell-format-word-function word)
+ (file-name-nondirectory ispell-program-name)
+ (or ispell-current-dictionary "default")))
(ispell-check-only ; called from ispell minor mode.
(if (fboundp 'make-extent)
(if (fboundp 'set-extent-property)
(setq line (1+ line))))
(insert (car guess) " ")
(setq guess (cdr guess)))
- (insert "\nUse option `i' to accept this spelling and put it in your private dictionary.")
+ (insert "\nUse option `i' to accept this spelling and put it in your private dictionary.\n")
(setq line (+ line (if choices 3 2)))))
(while (and choices
(< (if (> (+ 7 (current-column) (length (car choices))
search for the words (usually egrep).
Optional second argument contains the dictionary to use; the default is
-`ispell-alternate-dictionary', overriden by `ispell-complete-word-dict'
+`ispell-alternate-dictionary', overridden by `ispell-complete-word-dict'
if defined."
;; We don't use the filter for this function, rather the result is written
;; into a buffer. Hence there is no need to save the filter values.
(wild-p (string-match "\\*" word))
(look-p (and ispell-look-p ; Only use look for an exact match.
(or ispell-have-new-look (not wild-p))))
- (ispell-grep-buffer (get-buffer-create "*Ispell-Temp*")) ; result buf
(prog (if look-p ispell-look-command ispell-grep-command))
(args (if look-p ispell-look-options ispell-grep-options))
status results loc)
- (unwind-protect
- (save-window-excursion
- (message "Starting \"%s\" process..." (file-name-nondirectory prog))
- (set-buffer ispell-grep-buffer)
- (if look-p
- nil
- ;; convert * to .*
- (insert "^" word "$")
- (while (search-backward "*" nil t) (insert "."))
- (setq word (buffer-string))
- (erase-buffer))
- (setq status (apply 'ispell-call-process prog nil t nil
- (nconc (if (and args (> (length args) 0))
- (list args)
- (if look-p nil
- (list "-e")))
- (list word)
- (if lookup-dict (list lookup-dict)))))
- ;; grep returns status 1 and no output when word not found, which
- ;; is a perfectly normal thing.
- (if (stringp status)
- (setq results (cons (format "error: %s exited with signal %s"
- (file-name-nondirectory prog) status)
- results))
- ;; else collect words into `results' in FIFO order
- (goto-char (point-max))
- ;; assure we've ended with \n
- (or (bobp) (= (preceding-char) ?\n) (insert ?\n))
- (while (not (bobp))
- (setq loc (point))
- (forward-line -1)
- (setq results (cons (buffer-substring-no-properties (point)
- (1- loc))
- results)))))
- ;; protected
- (kill-buffer ispell-grep-buffer)
- (if (and results (string-match ".+: " (car results)))
- (error "%s error: %s" ispell-grep-command (car results))))
+ (with-temp-buffer
+ (message "Starting \"%s\" process..." (file-name-nondirectory prog))
+ (if look-p
+ nil
+ ;; Convert * to .*
+ (insert "^" word "$")
+ (while (search-backward "*" nil t) (insert "."))
+ (setq word (buffer-string))
+ (erase-buffer))
+ (setq status (apply 'ispell-call-process prog nil t nil
+ (nconc (if (and args (> (length args) 0))
+ (list args)
+ (if look-p nil
+ (list "-e")))
+ (list word)
+ (if lookup-dict (list lookup-dict)))))
+ ;; `grep' returns status 1 and no output when word not found, which
+ ;; is a perfectly normal thing.
+ (if (stringp status)
+ (error "error: %s exited with signal %s"
+ (file-name-nondirectory prog) status)
+ ;; Else collect words into `results' in FIFO order.
+ (goto-char (point-max))
+ ;; Assure we've ended with \n.
+ (or (bobp) (= (preceding-char) ?\n) (insert ?\n))
+ (while (not (bobp))
+ (setq loc (point))
+ (forward-line -1)
+ (push (buffer-substring-no-properties (point)
+ (1- loc))
+ results))))
+ (if (and results (string-match ".+: " (car results)))
+ (error "%s error: %s" ispell-grep-command (car results)))
results))
(setq start (1+ start)))) ; On block non-refresh, inc start.
(let ((modified (buffer-modified-p)) ; don't allow this fn to modify buffer
(buffer-read-only nil) ; Allow highlighting read-only buffers.
- (text (buffer-substring-no-properties start end)) ; Save hilight region
+ (text (buffer-substring-no-properties start end))
+ ; Save highlight region.
(inhibit-quit t) ; inhibit interrupt processing here.
(buffer-undo-list t)) ; don't clutter the undo list.
(goto-char end)
;; hidden by new window, scroll it to just below new win
;; otherwise set top line of other win so it doesn't scroll.
(if (< oldot top) (setq top oldot))
- ;; if frame is unsplitable, temporarily disable that...
+ ;; if frame is unsplittable, temporarily disable that...
(if (cdr (assq 'unsplittable (frame-parameters (selected-frame))))
(let ((frame (selected-frame)))
(modify-frame-parameters frame '((unsplittable . nil)))
(mapcar 'list (ispell-valid-dictionary-list)))
nil t)
current-prefix-arg))
- (ispell-set-spellchecker-params) ; Initilize variables and dicts alists
+ (ispell-set-spellchecker-params) ; Initialize variables and dicts alists
(unless arg (ispell-buffer-local-dict 'no-reload))
(if (equal dict "default") (setq dict nil))
;; This relies on completing-read's bug of returning "" for no match
(while (looking-at "[ \t\n]*\\[") (forward-sexp))
(forward-sexp (or arg 1)))
(error
- (message "error skipping s-expressions at point %d." (point))
+ (message "Error skipping s-expressions at point %d." (point))
(beep)
(sit-for 2))))
;;;###autoload
(define-minor-mode ispell-minor-mode
- "Toggle Ispell minor mode.
-With prefix argument ARG, turn Ispell minor mode on if ARG is positive,
-otherwise turn it off.
+ "Toggle last-word spell checking (Ispell minor mode).
+With a prefix argument ARG, enable Ispell minor mode if ARG is
+positive, and disable it otherwise. If called from Lisp, enable
+the mode if ARG is omitted or nil.
+
+Ispell minor mode is a buffer-local mior mode. When enabled,
+typing SPC or RET warns you if the previous word is incorrectly
+spelled.
-In Ispell minor mode, pressing SPC or RET
-warns you if the previous word is incorrectly spelled.
+All the buffer-local variables and dictionaries are ignored. To
+read them into the running ispell process, type \\[ispell-word]
+SPC.
-All the buffer-local variables and dictionaries are ignored -- to read
-them into the running ispell process, type \\[ispell-word] SPC."
+For spell-checking \"on the fly\", not just after typing SPC or
+RET, use `flyspell-mode'."
nil " Spell" ispell-minor-keymap)
(defun ispell-minor-check ()
'(
;; Don't spell check signatures
"^-- $"
- ;; Matches postscript files.
+ ;; Matches PostScript files.
;;"^%!PS-Adobe-[123].0"
;; Matches uuencoded text
;;"^begin [0-9][0-9][0-9] .*\nM.*\nM.*\nM"
(progn
(open-line 1)
(unless found (newline))
- (insert (if (fboundp 'comment-padright)
- ;; Try and use the proper comment marker,
- ;; e.g. ";;" rather than ";".
- (comment-padright comment-start
- (comment-add nil))
- comment-start)
- " " ispell-words-keyword)
- (if (> (length comment-end) 0)
+ (insert (if comment-start
+ (concat
+ (if (fboundp 'comment-padright)
+ ;; Try and use the proper comment marker,
+ ;; e.g. ";;" rather than ";".
+ (comment-padright comment-start
+ (comment-add nil))
+ comment-start)
+ " ")
+ "")
+ ispell-words-keyword)
+ (if (and comment-end (> (length comment-end) 0))
(save-excursion
(newline)
(insert comment-end)))))
; LocalWords: Francais Nederlands charset autoloaded popup nonmenu regexp num
; LocalWords: AMStex hspace includeonly nocite epsfig displaymath eqnarray reg
; LocalWords: minipage modeline pers dict unhighlight buf grep sync prev inc
-; LocalWords: fn hilight oldot NB AIX msg init read's bufs pt cmd Quinlan eg
-; LocalWords: uuencoded unidiff sc nn VM SGML eval IspellPersDict unsplitable
+; LocalWords: fn oldot NB AIX msg init read's bufs pt cmd Quinlan eg
+; LocalWords: uuencoded unidiff sc nn VM SGML eval IspellPersDict
; LocalWords: lns XEmacs HTML casechars Multibyte
;;; ispell.el ends here