[OS X Emacs] using Mac system spelling autocorrection?

Peter Salazar cycleofsong at gmail.com
Fri Feb 24 17:42:40 EST 2012


Thanks, and yes, truly automatic correction would be great. Does anyone out
there know how to do it?


On Thu, Feb 23, 2012 at 7:47 PM, David Reitter <david.reitter at gmail.com>wrote:

> On Feb 23, 2012, at 6:55 PM, Peter Salazar wrote:
>
> > You're right! And so it is. It looks like ispell is configured
> correctly. And when I mistype a word in Aquamacs, it appears in red and I
> can right-click and Aquamacs shows me nice suggestions.
> >
> > What I SHOULD have asked is: how do I get Aquamacs to automatically
> REPLACE mistyped words the way other OSX apps do (and the way abbrevs does)?
> >
> > Example: In TextEdit, if I type wihtout, it gets automatically changed
> to without.
>
> I see.
>
> Aquamacs can't do this as of now, but what you can do is press M-Tab after
> a word that's been highlighted (flyspell mode has to be on = Check Spelling
> as you Type).  That'll correct it, and you can cycle through different
> alternatives.
>
> That said, it wouldn't be hard to implement some sort of fully automatic
> correction.
> If someone here can do it, I'd be happy to integrate it with Aquamacs.  I
> don't have time to figure out the details at the moment.
>
> Flyspell already has the code in place to make this happen.  The following
> code is a proof-of-concept, although important bits don't work (I find it
> unusable).
>
> (defun my-flyspell-auto-correct-word (beg end corrections)
>  ;; "corrections" is, at times, incorrect (bug!)
>  (let ((alternative (car (ns-spellchecker-get-suggestions
> (buffer-substring beg end)))))
>    (when alternative
>      (undo-boundary) ;; this does not work
>      (save-excursion
>        (delete-region beg end)
>        (let ((transient-mark-mode t))
>          (funcall flyspell-insert-function alternative)))
>      ;; 'remove-highlighting
>      ;; M-tab afterwords also fails to work.
>      ;; Undo fails to work.
>      nil)))
>
> (add-hook 'flyspell-incorrect-hook 'my-flyspell-auto-correct-word)
>
>
> --
> http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
> http://aquamacs.org/donate -- Could we help you? Return the favor and
> support the Aquamacs Project!
>
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20120224/c76beffd/attachment.html>


More information about the MacOSX-Emacs mailing list