mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-05 11:45:45 +00:00
(ispell-process-line): Add local var line-offset to adjust for the change
in positions within the line, due to previous replacements.
This commit is contained in:
parent
d7e110e479
commit
2765768780
@ -1,3 +1,9 @@
|
|||||||
|
1999-12-28 Richard M. Stallman <rms@caffeine.ai.mit.edu>
|
||||||
|
|
||||||
|
* textmodes/ispell.el (ispell-process-line):
|
||||||
|
Add local var line-offset to adjust for the change
|
||||||
|
in positions within the line, due to previous replacements.
|
||||||
|
|
||||||
1999-12-27 Richard M. Stallman <rms@caffeine.ai.mit.edu>
|
1999-12-27 Richard M. Stallman <rms@caffeine.ai.mit.edu>
|
||||||
|
|
||||||
* lpr.el (lpr-buffer, print-buffer, lpr-region, print-region):
|
* lpr.el (lpr-buffer, print-buffer, lpr-region, print-region):
|
||||||
|
@ -2252,7 +2252,12 @@ otherwise, the current line is skipped."
|
|||||||
|
|
||||||
(defun ispell-process-line (string)
|
(defun ispell-process-line (string)
|
||||||
;;(declare special start end)
|
;;(declare special start end)
|
||||||
(let (poss)
|
(let (poss
|
||||||
|
;; line-offset is the change so far in the size of the line.
|
||||||
|
;; The position values we get from ispell reflect the original
|
||||||
|
;; text, and correction of previous words may have shifted the
|
||||||
|
;; current word within the line.
|
||||||
|
(line-offset 0))
|
||||||
;; send string to spell process and get input.
|
;; send string to spell process and get input.
|
||||||
(process-send-string ispell-process string)
|
(process-send-string ispell-process string)
|
||||||
(while (progn
|
(while (progn
|
||||||
@ -2270,7 +2275,8 @@ otherwise, the current line is skipped."
|
|||||||
;; Markers can move with highlighting! This destroys
|
;; Markers can move with highlighting! This destroys
|
||||||
;; end of region markers line-end and ispell-region-end
|
;; end of region markers line-end and ispell-region-end
|
||||||
(let ((word-start
|
(let ((word-start
|
||||||
(copy-marker (+ start ispell-offset (car (cdr poss)))))
|
(copy-marker (+ start ispell-offset line-offset
|
||||||
|
(car (cdr poss)))))
|
||||||
(word-len (length (car poss)))
|
(word-len (length (car poss)))
|
||||||
(line-end (copy-marker end))
|
(line-end (copy-marker end))
|
||||||
(line-start (copy-marker start))
|
(line-start (copy-marker start))
|
||||||
@ -2323,6 +2329,7 @@ otherwise, the current line is skipped."
|
|||||||
recheck-region t)
|
recheck-region t)
|
||||||
(delete-region (point) (+ word-len (point)))
|
(delete-region (point) (+ word-len (point)))
|
||||||
(insert (car replace))
|
(insert (car replace))
|
||||||
|
(setq line-offset (+ line-offset (- line-end end)))
|
||||||
;; Only typed-in replacements need to be re-checked.
|
;; Only typed-in replacements need to be re-checked.
|
||||||
(if (not (eq 'query-replace (car (cdr replace))))
|
(if (not (eq 'query-replace (car (cdr replace))))
|
||||||
(backward-char (length (car replace))))
|
(backward-char (length (car replace))))
|
||||||
@ -2355,6 +2362,8 @@ otherwise, the current line is skipped."
|
|||||||
(replace ; STRING REPLACEMENT for this word.
|
(replace ; STRING REPLACEMENT for this word.
|
||||||
(delete-region (point) (+ word-len (point)))
|
(delete-region (point) (+ word-len (point)))
|
||||||
(insert replace)
|
(insert replace)
|
||||||
|
(setq line-offset (+ line-offset (- line-end end)))
|
||||||
|
|
||||||
(set-marker line-start (+ line-start
|
(set-marker line-start (+ line-start
|
||||||
(- (length replace)
|
(- (length replace)
|
||||||
(length (car poss)))))))
|
(length (car poss)))))))
|
||||||
|
Loading…
Reference in New Issue
Block a user