- (concat
- "ispell-process-line: Ispell misalignment error:\n"
- (format " [Word from ispell pipe]: [%s], actual (point,line,column): (%s,%s,%s)\n"
- ispell-pipe-word actual-point actual-line actual-column)))
- (error (concat "Ispell misalignment: word "
- "`%s' point %d; probably incompatible versions")
- ispell-pipe-word actual-point)))
- ;; ispell-cmd-loop can go recursive & change buffer
- (if ispell-keep-choices-win
- (setq replace (ispell-command-loop
- (car (cdr (cdr poss)))
- (car (cdr (cdr (cdr poss))))
- (car poss) (marker-position word-start)
- (+ word-len (marker-position word-start))))
- (save-window-excursion
- (setq replace (ispell-command-loop
- (car (cdr (cdr poss)))
- (car (cdr (cdr (cdr poss))))
- (car poss) (marker-position word-start)
- (+ word-len (marker-position word-start))))))
-
- (goto-char word-start)
- ;; Recheck when query replace edit changes misspelled word.
- ;; Error in tex mode when a potential math mode change exists.
- (if (and replace (listp replace) (= 2 (length replace)))
- (if (and (eq ispell-parser 'tex)
- (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$"
- (regexp-quote string)))
- (error
- "Don't start query replace on a line with math characters"
- )
- (set-marker line-end (point))
- (setq ispell-filter nil
- recheck-region t)))
-
- ;; insert correction if needed
- (cond
- ((or (null replace)
- (equal 0 replace)) ; ACCEPT/INSERT
- (if (equal 0 replace) ; BUFFER-LOCAL DICT ADD
- (ispell-add-per-file-word-list (car poss)))
- ;; do not recheck accepted word on this line
- (setq accept-list (cons (car poss) accept-list)))
- (t ; replacement word selected or entered
- (delete-region (point) (+ word-len (point)))
- (if (not (listp replace))
- (progn
- (insert replace) ; insert dictionary word
- (ispell-send-replacement (car poss) replace)
- (setq accept-list (cons replace accept-list)))
- (let ((replace-word (car replace)))
- ;; Recheck hand entered replacement word
- (insert replace-word)
- (ispell-send-replacement (car poss) replace-word)
- (if (car (cdr replace))
- (save-window-excursion
- (delete-other-windows) ; to correctly show help.
- ;; Assume case-replace &
- ;; case-fold-search correct?
- (query-replace (car poss) (car replace) t)))
- (goto-char word-start)
- ;; do not recheck if already accepted
- (if (member replace-word accept-list)
- (setq accept-list (cons replace-word accept-list)
- replace replace-word)
- (let ((region-end (copy-marker ispell-region-end)))
- (setq recheck-region ispell-filter
- ispell-filter nil ; save filter
- shift 0 ; already accounted
- shift (ispell-region
- word-start
- (+ word-start (length replace-word))
- t shift))
- (if (null shift) ; quitting check.
- (setq shift 0))
- (set-marker ispell-region-end region-end)
- (set-marker region-end nil)
- (setq ispell-filter recheck-region
- recheck-region nil
- replace replace-word)))))
-
- (setq shift (+ shift (- (length replace) word-len)))
-
- ;; Move line-start across word...
- ;; new shift function does this now...
- ;;(set-marker line-start (+ line-start
- ;; (- (length replace)
- ;; (length (car poss)))))
- ))
- (if (not ispell-quit)
+ "ispell-process-line: Ispell misalignment error:
+ [Word from ispell pipe]: [%s], actual (point,line,column): (%s,%s,%s)\n"
+ ispell-pipe-word actual-point actual-line actual-column)
+ (error (concat "Ispell misalignment: word "
+ "`%s' point %d; probably incompatible versions")
+ ispell-pipe-word actual-point)))
+ ;; ispell-cmd-loop can go recursive & change buffer
+ (if ispell-keep-choices-win
+ (setq replace (ispell-command-loop
+ (car (cdr (cdr poss)))
+ (car (cdr (cdr (cdr poss))))
+ (car poss) (marker-position word-start)
+ (+ word-len (marker-position word-start))))
+ (save-window-excursion
+ (setq replace (ispell-command-loop
+ (car (cdr (cdr poss)))
+ (car (cdr (cdr (cdr poss))))
+ (car poss) (marker-position word-start)
+ (+ word-len (marker-position word-start))))))
+
+ (goto-char word-start)
+ ;; Recheck when query replace edit changes misspelled word.
+ ;; Error in tex mode when a potential math mode change exists.
+ (if (and replace (listp replace) (= 2 (length replace)))
+ (if (and (eq ispell-parser 'tex)
+ (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$"
+ (regexp-quote string)))
+ (error
+ "Don't start query replace on a line with math characters"
+ )
+ (set-marker line-end (point))
+ (setq ispell-filter nil
+ recheck-region t)))
+
+ ;; Insert correction if needed.
+ (cond
+ ((or (null replace)
+ (equal 0 replace)) ; ACCEPT/INSERT
+ (if (equal 0 replace) ; BUFFER-LOCAL DICT ADD
+ (ispell-add-per-file-word-list (car poss)))
+ ;; Do not recheck accepted word on this line.
+ (setq accept-list (cons (car poss) accept-list)))
+ (t ; Replacement word selected or entered.
+ (delete-region (point) (+ word-len (point)))
+ (if (not (listp replace))
+ (progn
+ (insert replace) ; Insert dictionary word.
+ (ispell-send-replacement (car poss) replace)
+ (setq accept-list (cons replace accept-list)))
+ (let ((replace-word (car replace)))
+ ;; Recheck hand entered replacement word.
+ (insert replace-word)
+ (ispell-send-replacement (car poss) replace-word)
+ (if (car (cdr replace))
+ (save-window-excursion
+ (delete-other-windows) ; to correctly show help.
+ ;; Assume case-replace &
+ ;; case-fold-search correct?
+ (query-replace (car poss) (car replace) t)))
+ (goto-char word-start)
+ ;; Do not recheck if already accepted.
+ (if (member replace-word accept-list)
+ (setq accept-list (cons replace-word accept-list)
+ replace replace-word)
+ (let ((region-end (copy-marker ispell-region-end)))
+ (setq recheck-region ispell-filter
+ ispell-filter nil ; Save filter.
+ shift 0 ; Already accounted.
+ shift (ispell-region
+ word-start
+ (+ word-start (length replace-word))
+ t shift))
+ (if (null shift) ; Quitting check.
+ (setq shift 0))
+ (set-marker ispell-region-end region-end)
+ (set-marker region-end nil)
+ (setq ispell-filter recheck-region
+ recheck-region nil
+ replace replace-word)))))
+
+ (setq shift (+ shift (- (length replace) word-len)))
+
+ ;; Move line-start across word...
+ ;; new shift function does this now...
+ ;;(set-marker line-start (+ line-start
+ ;; (- (length replace)
+ ;; (length (car poss)))))
+ ))
+ (if (not ispell-quit)