[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: auto correction propagation mode
From: |
Andreas Röhler |
Subject: |
Re: auto correction propagation mode |
Date: |
Sat, 7 Jun 2008 20:05:59 +0200 |
User-agent: |
KMail/1.9.6 (enterprise 20070904.708012) |
Am Samstag, 7. Juni 2008 schrieb Plamen Tanovski:
> Hi,
>
> I need a mode, where emacs "whatches" my typing, and if I correct a word,
> emacs does the same correction on all remaining text in the buffer, after I
> leave the word. For example, if I correct the _first_ "foo" to "fip" in
>
> The foo is not always foo, not even really foo.
>
> emacs changes automatically the sentence (in the background) to
>
> The fip is not always fip, not even really fip.
>
> I searched the net but didn't find smth. apropriate.
>
>
> Best regards
>
Just to indicate a direction how this could be done IMHO:
(defun allkorr ()
(interactive "*")
(let* ((wap (word-at-point))
(replmt (read-from-minibuffer "Correction: " wap)))
(define-abbrev text-mode-abbrev-table wap replmt)
(expand-region-abbrevs (point-min) (point-max))))
It uses the abbrev facility, prompts for the correct
word, which will be registered as an expansion for the
then wrong word, conceived as an abbrev in the text.
`expand-region-abbrevs' will query you then for every
replacement. This might be abolished still, bound to an
argument etc.
HTH
Andreas Röhler