help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spellcheck against multiple dictionaries?


From: address@hidden
Subject: Re: Spellcheck against multiple dictionaries?
Date: Fri, 20 Mar 2009 12:54:10 -0700 (PDT)
User-agent: G2/1.0

Hello!

I'm the original thread starter. Thanks for your feedback.

On 19 мар, 18:34, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> On Thu, Mar 19, 2009 at 3:29 PM, Miles Bader <mi...@gnu.org> wrote:
> > Potentially, it seems that you could keep multiple ispell processes
> > around, and feed each word to _all_ active processes.
>
> I think Peter Heslin implemented something like that here:
>
>  http://www.dur.ac.uk/p.j.heslin/Software/Emacs/
>
> (Wasn't there a discussion about getting this into Emacs? Or am I just
> dreaming?)

I've looked though ispell-multi.el, and indeed keeping several ispell
processes would be nice for the approach I've tried to describe. But
this is ultimately just details of implementation and not the feature
I'm looking for.

I've created a sketch of the desired functionality. Hope the code
speaks better:

(defun ispell-word-with-dictionary (dict)
  "Spellcheck word with given dictionary."
  (ispell-change-dictionary dict)
  (ispell-word))

(defun ispell-word-smart ()
  "Spellcheck word with British or, if that failed, with Russian
dictionary."
  (interactive)
  (condition-case nil
      (ispell-word-with-dictionary "british")
    (error (ispell-word-with-dictionary "russian"))))

It required me to tweak the code in ispell.el for the feature to
actually work:

*** /home/pent/emacs/emacs/lisp/textmodes/ispell.el     2009-02-27
21:48:23.000000000 +0300
--- /home/pent/ispell.el        2009-03-20 22:16:25.000000000 +0300
***************
*** 1689,1695 ****
                  (extent-at start)
                  (and (fboundp 'delete-extent)
                       (delete-extent (extent-at start)))))
!           ((null poss) (message "Error in ispell process"))
            (ispell-check-only        ; called from ispell minor mode.
             (if (fboundp 'make-extent)
                 (if (fboundp 'set-extent-property)
--- 1689,1695 ----
                  (extent-at start)
                  (and (fboundp 'delete-extent)
                       (delete-extent (extent-at start)))))
!           ((null poss) (error "Error in ispell process"))
            (ispell-check-only        ; called from ispell minor mode.
             (if (fboundp 'make-extent)
                 (if (fboundp 'set-extent-property)

Please note that the code above is just a prototype (i.e. it doesn't
restore the original dictionary, the dictionaries are not
customisable, ...). Do you think the idea is reasonable?

Andrey Paramonov

P.S: Perhaps I should post to emacs-devel?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]