comparison lisp/textmodes/ispell.el @ 94382:d97dbf46a59a

(ispell-insert-word): Revert previous change.
author Glenn Morris <rgm@gnu.org>
date Sat, 26 Apr 2008 20:14:12 +0000
parents 247f69050a59
children 2be356624ede
comparison
equal deleted inserted replaced
94381:0a65cf8b9e03 94382:d97dbf46a59a
1526 (let ((start (point))) 1526 (let ((start (point)))
1527 (forward-line) 1527 (forward-line)
1528 (delete-region start (point))) 1528 (delete-region start (point)))
1529 (setq more-lines (= 0 (forward-line)))))))))))))) 1529 (setq more-lines (= 0 (forward-line))))))))))))))
1530 1530
1531
1532 ;; Insert WORD while translating Latin characters to the equivalent
1533 ;; characters that is supported by buffer-file-coding-system.
1534
1535 (defun ispell-insert-word (word)
1536 (let ((pos (point)))
1537 (insert word)
1538 (if (char-table-p translation-table-for-input)
1539 (translate-region pos (point) translation-table-for-input))))
1540
1531 ;;;###autoload 1541 ;;;###autoload
1532 (defun ispell-word (&optional following quietly continue region) 1542 (defun ispell-word (&optional following quietly continue region)
1533 "Check spelling of word under or before the cursor. 1543 "Check spelling of word under or before the cursor.
1534 If the word is not found in dictionary, display possible corrections 1544 If the word is not found in dictionary, display possible corrections
1535 in a window allowing you to choose one. 1545 in a window allowing you to choose one.
1635 (progn 1645 (progn
1636 (goto-char start) 1646 (goto-char start)
1637 ;; Insert first and then delete, 1647 ;; Insert first and then delete,
1638 ;; to avoid collapsing markers before and after 1648 ;; to avoid collapsing markers before and after
1639 ;; into a single place. 1649 ;; into a single place.
1640 (insert new-word) 1650 (ispell-insert-word new-word)
1641 (delete-region (point) end) 1651 (delete-region (point) end)
1642 ;; It is meaningless to preserve the cursor position 1652 ;; It is meaningless to preserve the cursor position
1643 ;; inside a word that has changed. 1653 ;; inside a word that has changed.
1644 (setq cursor-location (point)) 1654 (setq cursor-location (point))
1645 (setq end (point)))) 1655 (setq end (point))))
3066 (setq accept-list (cons (car poss) accept-list))) 3076 (setq accept-list (cons (car poss) accept-list)))
3067 (t ; replacement word selected or entered 3077 (t ; replacement word selected or entered
3068 (delete-region (point) (+ word-len (point))) 3078 (delete-region (point) (+ word-len (point)))
3069 (if (not (listp replace)) 3079 (if (not (listp replace))
3070 (progn 3080 (progn
3071 (insert replace) ; insert dictionary word 3081 (ispell-insert-word replace) ; insert dictionary word
3072 (ispell-send-replacement (car poss) replace) 3082 (ispell-send-replacement (car poss) replace)
3073 (setq accept-list (cons replace accept-list))) 3083 (setq accept-list (cons replace accept-list)))
3074 (let ((replace-word (car replace))) 3084 (let ((replace-word (car replace)))
3075 ;; Recheck hand entered replacement word 3085 ;; Recheck hand entered replacement word
3076 (insert replace-word) 3086 (insert replace-word)
3236 (replacement ; REPLACEMENT WORD 3246 (replacement ; REPLACEMENT WORD
3237 (delete-region start end) 3247 (delete-region start end)
3238 (setq word (if (atom replacement) replacement (car replacement)) 3248 (setq word (if (atom replacement) replacement (car replacement))
3239 cursor-location (+ (- (length word) (- end start)) 3249 cursor-location (+ (- (length word) (- end start))
3240 cursor-location)) 3250 cursor-location))
3241 (insert word) 3251 (ispell-insert-word word)
3242 (if (not (atom replacement)) ; recheck spelling of replacement. 3252 (if (not (atom replacement)) ; recheck spelling of replacement.
3243 (progn 3253 (progn
3244 (goto-char cursor-location) 3254 (goto-char cursor-location)
3245 (ispell-word nil t))))) 3255 (ispell-word nil t)))))
3246 (if (get-buffer ispell-choices-buffer) 3256 (if (get-buffer ispell-choices-buffer)