* Automatic handling of TYpos
@ 2007-02-01 16:15 HS
2007-02-01 21:00 ` Peter Dyballa
[not found] ` <mailman.3886.1170363669.2155.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 4+ messages in thread
From: HS @ 2007-02-01 16:15 UTC (permalink / raw)
To: help-gnu-emacs
Olá!
Is there any emacs function that I can turn on to fix THis KInd of
MIstakes automatically ?
Thanks!
HS
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Automatic handling of TYpos
@ 2007-02-02 7:34 martin rudalics
0 siblings, 0 replies; 4+ messages in thread
From: martin rudalics @ 2007-02-02 7:34 UTC (permalink / raw)
To: hugows; +Cc: help-gnu-emacs
> Is there any emacs function that I can turn on to fix THis KInd of
> MIstakes automatically ?
In your example there are actually _two_ kinds of "mistakes". One kind
is that you capitalize words like "this" or "kind" in the middle of a
sentence. There's no simple solution to that. The other mistake is
that of an upper-case character in the second position of a word.
Correcting the latter should not be difficult with flyspell. Try adding
code like the 100% untested below to `flyspell-incorrect-hook' (and be
aware of the fact that auto-correction is something you'll hardly notice
while typing).
(defun flyspell-maybe-downcase-second-character (beg end guesses)
"Try to downcase second character."
(when (consp guesses)
(let ((string (buffer-substring beg end))
second)
(when (and (> (- end beg) 1)
(not (equal (aref string 0) (downcase (aref string 0))))
(not (equal (aref string 1) (downcase (aref string 1)))))
(setq string
(concat
(substring string 0 1)
(setq second (downcase (substring string 1 2)))
(substring string 2)))
(catch 'done
(dolist (guess guesses)
(when (string-equal string guess)
(goto-char (1+ beg))
(insert second)
(delete-char 1)
(throw 'done t))))))))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-02 7:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 16:15 Automatic handling of TYpos HS
2007-02-01 21:00 ` Peter Dyballa
[not found] ` <mailman.3886.1170363669.2155.help-gnu-emacs@gnu.org>
2007-02-01 21:57 ` Charles philip Chan
-- strict thread matches above, loose matches on Subject: below --
2007-02-02 7:34 martin rudalics
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.