all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "cmr.Pent@gmail.com" <cmr.Pent@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Spellcheck against multiple dictionaries?
Date: Fri, 20 Mar 2009 12:54:10 -0700 (PDT)	[thread overview]
Message-ID: <26daec6e-4cc2-4c22-b5ff-c19de5906fc4@v15g2000yqn.googlegroups.com> (raw)
In-Reply-To: mailman.3577.1237476870.31690.help-gnu-emacs@gnu.org

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?


  parent reply	other threads:[~2009-03-20 19:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <49C09110.9010105@gmx.at>
     [not found] ` <5f0660120903181236g3714f647ia568e3d02ae4fe56@mail.gmail.com>
2009-03-19  8:17   ` Spellcheck against multiple dictionaries? martin rudalics
     [not found]   ` <mailman.3552.1237450712.31690.help-gnu-emacs@gnu.org>
2009-03-19  9:30     ` Sergei
2009-03-19 14:29       ` Miles Bader
2009-03-19 15:34         ` Lennart Borgman
     [not found]         ` <mailman.3577.1237476870.31690.help-gnu-emacs@gnu.org>
2009-03-20 19:54           ` cmr.Pent [this message]
2009-03-14 16:04 cmr.Pent
2009-03-18 19:36 ` cmr.Pent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26daec6e-4cc2-4c22-b5ff-c19de5906fc4@v15g2000yqn.googlegroups.com \
    --to=cmr.pent@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.