all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ispell single word
@ 2019-02-15 20:50 Emanuel Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2019-02-15 20:50 UTC (permalink / raw)
  To: help-gnu-emacs

How do I spell a single word, from Lisp, with
ispell? (Indeed, how do ispell with ispell...)

I just wrote this. It does seem to work but the
code looks - well, like something you are not
supposed to understand!

(require 'ispell)

(defun spell-one-word (word)
  (with-temp-buffer
    (save-excursion
      (insert word) )
    (condition-case nil
        (not (ispell-word))
      (error nil)
      )))
;; (spell-one-word "length") ; t
;; (spell-one-word "lenght") ; nil

But I guess I like it fine - so far.

More on this:

    http://user.it.uu.se/~embe8573/emacs-init/spell-new.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 6+ messages in thread

* ispell single word
@ 2019-02-17  7:15 Emanuel Berg
  2019-02-17 15:33 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2019-02-17  7:15 UTC (permalink / raw)
  To: emacs-devel

How do I spell a single word, from Lisp, with
ispell? (Indeed, how do ispell with ispell...)

I just wrote this. It does seem to work but the
code looks - well, like something you are not
supposed to understand!

(require 'ispell)

(defun spell-one-word (word)
  (with-temp-buffer
    (save-excursion
      (insert word) )
    (condition-case nil
        (not (ispell-word))
      (error nil)
      )))
;; (spell-one-word "length") ; t
;; (spell-one-word "lenght") ; nil

But I guess I like it fine - so far.

More on this:

    http://user.it.uu.se/~embe8573/emacs-init/spell-new.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ispell single word
  2019-02-17  7:15 ispell single word Emanuel Berg
@ 2019-02-17 15:33 ` Eli Zaretskii
  2019-02-17 16:36   ` Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-02-17 15:33 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

> From: Emanuel Berg <moasenwood@zoho.eu>
> Date: Sun, 17 Feb 2019 08:15:52 +0100
> 
> How do I spell a single word, from Lisp, with
> ispell?

Can you describe a use case where one needs to spell-check in Emacs a
word that is given as a string, and is not present in any buffer?
Because if the word is in some buffer, ispell-word, by default bound
to M-$, already does what you want.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ispell single word
  2019-02-17 15:33 ` Eli Zaretskii
@ 2019-02-17 16:36   ` Emanuel Berg
  2019-02-17 18:58     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Emanuel Berg @ 2019-02-17 16:36 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii wrote:

>> How do I spell a single word, from Lisp,
>> with ispell?
>
> Can you describe a use case where one needs
> to spell-check in Emacs a word that is given
> as a string, and is not present in
> any buffer?

The base use case is being able to ask Emacs,
is this the correct spelling of
a particular word?

One advanced use case can be in combination
with this string permutation code [1] - you can
feed a bunch of chars to it, get all possible
strings, then feed the strings to the checker
and thus filter out all possible words you can
form with the letters.

[1] http://user.it.uu.se/~embe8573/emacs-init/perm.el

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ispell single word
  2019-02-17 16:36   ` Emanuel Berg
@ 2019-02-17 18:58     ` Eli Zaretskii
  2019-02-17 19:27       ` Emanuel Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-02-17 18:58 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: emacs-devel

> From: Emanuel Berg <moasenwood@zoho.eu>
> Date: Sun, 17 Feb 2019 17:36:37 +0100
> 
> Eli Zaretskii wrote:
> 
> >> How do I spell a single word, from Lisp,
> >> with ispell?
> >
> > Can you describe a use case where one needs
> > to spell-check in Emacs a word that is given
> > as a string, and is not present in
> > any buffer?
> 
> The base use case is being able to ask Emacs,
> is this the correct spelling of
> a particular word?

Type it and then invoke "M-$".



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: ispell single word
  2019-02-17 18:58     ` Eli Zaretskii
@ 2019-02-17 19:27       ` Emanuel Berg
  0 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg @ 2019-02-17 19:27 UTC (permalink / raw)
  To: emacs-devel

Eli Zaretskii wrote:

>> The base use case is being able to ask
>> Emacs, is this the correct spelling of
>> a particular word?
>
> Type it and then invoke "M-$".

Boy, ispell really does stink it can't do this
programmatically. Well, at least mine can,
altho in an intricate, reversed way which
doesn't seem sound or natural.

It is a small wonder, in an ironic way, that
this isn't one of the first - if not *the*
first - building block around which the whole
software is made!

BTW who needs `+' to do addition in Lisp?
(+ 1 2 3) and such? When everyone knows it is
much more convenient to read the digits from
a buffer?

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-02-17 19:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17  7:15 ispell single word Emanuel Berg
2019-02-17 15:33 ` Eli Zaretskii
2019-02-17 16:36   ` Emanuel Berg
2019-02-17 18:58     ` Eli Zaretskii
2019-02-17 19:27       ` Emanuel Berg
  -- strict thread matches above, loose matches on Subject: below --
2019-02-15 20:50 Emanuel Berg

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.