11

The question What options are there for doing spell-checking in emacs discuss various spell checking solutions for Emacs. Emacs ispell interface uses external tools such as Aspell or Hunspell for spell checking. Considering the fact that many free dictionary files are available (for example by Openoffice see for example the dictionary file en_US.zip) I am wondering if it would be possible to write a native spell checking function in Emacs using such free dictionary files.

Added: More precisely I am wondering if there are existing packages which can be used for spell-checking (without using external tools such as Aspell or Hunspell) within Emacs. A tool which checks if a word is correct and if not suggests some corrections.

In case the answer is negative, any hint to do this would be helpful.

14
  • 2
    Of course it would be possible. Can you clarify if you are looking for existing packages that do this or for pointers of how you could implement it yourself.
    – verdammelt
    Commented Feb 10, 2015 at 17:49
  • 2
    @Name, I've seen you ask a few Windows-related questions, and I suspect that Windows is what prompted you to ask this one. I highly recommend using 32-bit Cygwin on Windows. I use it on 2/3 of my computers (work and gaming pc) With the emacs-w32 package, Emacs uses the native Windows GUI. You get access to a ton of prebuilt Unix, Linux, and GNU packages (including aspell), and the ability to easily compile others from source (e.g., aspell compiles fine with no extra effort in Cygwin). Granted, there are hiccups, but overall I think it's better than native Windows.
    – nanny
    Commented Feb 10, 2015 at 18:10
  • 6
    @Name the problem with on-the-fly spellchecking, of course, will be performance. Emacs Lisp is not fast, and this is not really the sort of thing that it does well. Because you really don't want to block the main thread, you'll need to spawn an async child process, to do the spellchecking. This would probably be more work than it's worth, unless it's worth an awful lot.
    – PythonNut
    Commented Feb 10, 2015 at 19:56
  • 3
    Peter Norvig says that his Python spell checker is very fast. I guess reimplementing it in Elisp might be a nice exercise.
    – mbork
    Commented Mar 23, 2015 at 20:48
  • 3
    Here it is as a decently working minor mode: gist.github.com/jordonbiondo/7a729b652360a528f117 You'll need to provide your own dictionary file, but there is a link to one in the docs. Commented May 1, 2015 at 13:45

2 Answers 2

2

From the comments, Jordon Biondo has some proof-of-concept code at

https://gist.github.com/jordonbiondo

see in particular se-spell.el and elisp-checker.el.

0

See: spell-fu this highlights misspelled words, without calling external processes.

Although currently the aspell is used for the initial dictionary dump.

3
  • Thank you. I get the error spell-fu--word-list-ensure: Wrong type argument: stringp, nil after enabling spell-fu mode.
    – Name
    Commented May 19, 2021 at 14:29
  • Could you run C-x, toggle-debug-on-error - then enable spell-fu mode? (this is worth a bug report).
    – ideasman42
    Commented May 19, 2021 at 15:09
  • Apparently, the problem came from the fact that the file \.emacs.d\spell-fu\words_default.txt didn't exist. I create that file and the error disappeared. Could you please explain, what should be the content of this file? Any large file of correct spelled words? Perhaps it would be helpful to give indication to use a freely available file.
    – Name
    Commented May 19, 2021 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.