aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorJohn Wiegley2000-10-29 05:18:48 +0000
committerJohn Wiegley2000-10-29 05:18:48 +0000
commitdace60cfea488a9cc8a775109c56b66907aa6abb (patch)
tree364b9c0114540a5f51a42e1e28a37b98714edaee /lisp/textmodes
parent657f9cb8b7f7c3a9687f3998319ce63346ef13a4 (diff)
downloademacs-dace60cfea488a9cc8a775109c56b66907aa6abb.tar.gz
emacs-dace60cfea488a9cc8a775109c56b66907aa6abb.zip
See ChangeLog
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/flyspell.el56
1 files changed, 30 insertions, 26 deletions
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index fe95b3faa59..74c07f19602 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1986,7 +1986,7 @@ The word checked is the word at the mouse position."
1986 menu)))) 1986 menu))))
1987 1987
1988;*---------------------------------------------------------------------*/ 1988;*---------------------------------------------------------------------*/
1989;* Some example functions for real autocrrecting */ 1989;* Some example functions for real autocrrecting xb */
1990;*---------------------------------------------------------------------*/ 1990;*---------------------------------------------------------------------*/
1991(defun flyspell-maybe-correct-transposition (beg end poss) 1991(defun flyspell-maybe-correct-transposition (beg end poss)
1992 "Apply 'transpose-chars' to all points in the region BEG to END and 1992 "Apply 'transpose-chars' to all points in the region BEG to END and
@@ -1994,17 +1994,24 @@ return t if any those result in a possible replacement suggested by ispell
1994in POSS. Otherwise the change is undone. 1994in POSS. Otherwise the change is undone.
1995 1995
1996This function is meant to be added to 'flyspell-incorrect-hook'." 1996This function is meant to be added to 'flyspell-incorrect-hook'."
1997 (when (consp poss) 1997 (when (consp poss)
1998 (catch 'done 1998 (catch 'done
1999 (save-excursion 1999 (let ((str (buffer-substring beg end))
2000 (goto-char (1+ beg)) 2000 (i 0) (len (- end beg)) tmp)
2001 (while (< (point) end) 2001 (while (< (1+ i) len)
2002 (transpose-chars 1) 2002 (setq tmp (aref str i))
2003 (when (member (buffer-substring beg end) (nth 2 poss)) 2003 (aset str i (aref str (1+ i)))
2004 (throw 'done t)) 2004 (aset str (1+ i) tmp)
2005 (transpose-chars -1) 2005 (when (member str (nth 2 poss))
2006 (forward-char)) 2006 (save-excursion
2007 nil)))) 2007 (goto-char (+ beg i 1))
2008 (transpose-chars 1))
2009 (throw 'done t))
2010 (setq tmp (aref str i))
2011 (aset str i (aref str (1+ i)))
2012 (aset str (1+ i) tmp)
2013 (setq i (1+ i))))
2014 nil)))
2008 2015
2009(defun flyspell-maybe-correct-doubling (beg end poss) 2016(defun flyspell-maybe-correct-doubling (beg end poss)
2010 "For each doubled charachter in the region BEG to END, remove one and 2017 "For each doubled charachter in the region BEG to END, remove one and
@@ -2014,21 +2021,18 @@ in POSS. Otherwise the change is undone.
2014This function is meant to be added to 'flyspell-incorrect-hook'." 2021This function is meant to be added to 'flyspell-incorrect-hook'."
2015 (when (consp poss) 2022 (when (consp poss)
2016 (catch 'done 2023 (catch 'done
2017 (save-excursion 2024 (let ((str (buffer-substring beg end))
2018 (let ((last (char-after beg)) 2025 (i 0) (len (- end beg)))
2019 this) 2026 (while (< (1+ i) len)
2020 (goto-char (1+ beg)) 2027 (when (and (= (aref str i) (aref str (1+ i)))
2021 (while (< (point) end) 2028 (member (concat (substring str 0 (1+ i))
2022 (setq this (char-after)) 2029 (substring str (+ i 2)))
2023 (if (not (char-equal this last)) 2030 (nth 2 poss)))
2024 (forward-char) 2031 (goto-char (+ beg i))
2025 (delete-char 1) 2032 (delete-char 1)
2026 (when (member (buffer-substring beg (1- end)) (nth 2 poss)) 2033 (throw 'done t))
2027 (throw 'done t)) 2034 (setq i (1+ i))))
2028 ;; undo 2035 nil)))
2029 (insert-char this 1))
2030 (setq last this))
2031 nil)))))
2032 2036
2033;*---------------------------------------------------------------------*/ 2037;*---------------------------------------------------------------------*/
2034;* flyspell-already-abbrevp ... */ 2038;* flyspell-already-abbrevp ... */