comparison lisp/textmodes/ispell.el @ 59627:24c3aed806c6

(ispell-looking-at): New function. (ispell-process-line): Use ispell-looking-at to compare the ispell output and the buffer contents.
author Kenichi Handa <handa@m17n.org>
date Tue, 18 Jan 2005 23:16:27 +0000
parents 13bdf84b5df8
children 08c7f3c89c0b 6d92d69fae33
comparison
equal deleted inserted replaced
59626:48b06baddb8a 59627:24c3aed806c6
1089 (aset table v (concat unified (string c)))))) 1089 (aset table v (concat unified (string c))))))
1090 ucs-mule-8859-to-mule-unicode) 1090 ucs-mule-8859-to-mule-unicode)
1091 table)) 1091 table))
1092 1092
1093 ;; Return a string decoded from Nth element of the current dictionary 1093 ;; Return a string decoded from Nth element of the current dictionary
1094 ;; while splice equivalent characters into the string. This splicing 1094 ;; while splicing equivalent characters into the string. This splicing
1095 ;; is done only if the string is a regular expression of the form 1095 ;; is done only if the string is a regular expression of the form
1096 ;; "[...]" because, otherwise, splicing will result in incorrect 1096 ;; "[...]" because, otherwise, splicing will result in incorrect
1097 ;; regular expression matching. 1097 ;; regular expression matching.
1098 1098
1099 (defun ispell-get-decoded-string (n) 1099 (defun ispell-get-decoded-string (n)
2792 (goto-char end)) 2792 (goto-char end))
2793 (t (goto-char end))) ; EMPTY LINE, skip it. 2793 (t (goto-char end))) ; EMPTY LINE, skip it.
2794 string)) 2794 string))
2795 2795
2796 2796
2797 (defun ispell-looking-at (string)
2798 (let ((coding (ispell-get-coding-system))
2799 (len (length string)))
2800 (and (<= (+ (point) len) (point-max))
2801 (equal (encode-coding-string string coding)
2802 (encode-coding-string (buffer-substring-no-properties
2803 (point) (+ (point) len))
2804 coding)))))
2805
2797 ;;; Avoid error messages when compiling for these dynamic variables. 2806 ;;; Avoid error messages when compiling for these dynamic variables.
2798 (eval-when-compile 2807 (eval-when-compile
2799 (defvar start) 2808 (defvar start)
2800 (defvar end)) 2809 (defvar end))
2801 2810
2840 (goto-char word-start) 2849 (goto-char word-start)
2841 (ispell-horiz-scroll) 2850 (ispell-horiz-scroll)
2842 2851
2843 ;; Alignment cannot be tracked and this error will occur when 2852 ;; Alignment cannot be tracked and this error will occur when
2844 ;; `query-replace' makes multiple corrections on the starting line. 2853 ;; `query-replace' makes multiple corrections on the starting line.
2845 (if (/= (+ word-len (point)) 2854 (or (ispell-looking-at (car poss))
2846 (progn
2847 ;; NB: Search can fail with Mule coding systems that don't
2848 ;; display properly. Ignore the error in this case?
2849 (search-forward (car poss) (+ word-len (point)) t)
2850 (point)))
2851 ;; This occurs due to filter pipe problems 2855 ;; This occurs due to filter pipe problems
2852 (error (concat "Ispell misalignment: word " 2856 (error (concat "Ispell misalignment: word "
2853 "`%s' point %d; probably incompatible versions") 2857 "`%s' point %d; probably incompatible versions")
2854 (car poss) (marker-position word-start))) 2858 (car poss) (marker-position word-start)))
2855 ;; ispell-cmd-loop can go recursive & change buffer 2859 ;; ispell-cmd-loop can go recursive & change buffer