[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Testing validity of a word
From: |
uzibalqa |
Subject: |
Re: Testing validity of a word |
Date: |
Wed, 26 Jul 2023 17:08:33 +0000 |
------- Original Message -------
On Thursday, July 27th, 2023 at 12:06 AM, Emanuel Berg <incal@dataswamp.org>
wrote:
> uzibalqa wrote:
>
> > I want to test whether a word is valid. Is there a package
> > in Emacs for dictionary word lookup ?
>
>
> (defun spell-word (word)
> (with-temp-buffer
> (save-excursion
> (insert word) )
> (condition-case nil
> (not (ispell-word))
> (error nil) )))
>
> ;; (spell-word "length") ; t
> ;; (spell-word "lenght") ; nil
>
> --
> underground experts united
> https://dataswamp.org/~incal
The following could be less intensive
(defun is-valid-word (word)
"Check if the WORD is valid using `ispell`."
(ispell-lookup-words word))