emacs-devel
[Top][All Lists]
Advanced

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

Adding ispell-multi.el and friends to Emacs


From: Peter Heslin
Subject: Adding ispell-multi.el and friends to Emacs
Date: Thu, 14 Jun 2007 13:58:54 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux)

In another thread, it was suggested that this might be a good time to
suggest including a package of mine, ispell-multi.el, in Emacs, possibly
along with two other packages that depend on it.  When I posted
ispell-multi to emacs.sources a few years ago, RMS expressed an interest
in including it in Emacs.  He noted a few things that needed fixing, and I
believe these have been fixed in the interim.

ispell-multi.el extends ispell.el so that it maintains a collection of
running ispell processes instead of just one.  So if you have one buffer
in English and another in French, Emacs no longer kills the old process
and starts a new one every time you switch buffers.  This is a useful
feature, but the real reason I wrote it is to support the ability to
spell-check multiple languages in the same buffer using flyspell.
Without the ability to maintain several running processes, there would
be a very noticeable delay when moving the cursor from one language region 
to another.

ispell-multi therefore also provides a hook that tells flyspell to
switch languages depending on the value of a particular text property,
and provides hooks to trigger re-parsing of the buffer in order to set
that text property to the correct language.  This facility is used by
two other packages of mine, both of which allow you to mix text in
different languages in the same buffer, and have flyspell check it all.

These two packages might also be considered for inclusion:

* flyspell-babel.el: It roughly parses a LaTeX buffer and sets the text
  property to the correct language for flyspell, depending on the Babel
  language-switching commands in the buffer.  These are configurable, so
  if you use custom LaTeX commands instead of Babel, you can still use
  the package.  Of course, TeX can only be parsed by TeX, so it is far
  from foolproof; but it does work well for normal usage.

* flyspell-xml-multi.el:  As above, but changes the language for
  flyspell depending on the xml:lang attribute of the current element in
  an XML buffer.  If the major mode is nxml-mode, it should understand XML
  pretty well; if not, it falls back on an even rougher sort of parsing
  than what is used for LaTeX.

I believe the only change that would be required in Emacs to integrate
these would be to provide a hook in ispell-accept-buffer-local-defs in
ispell.el where ispell-multi could be called.  This is currently
achieved by means of a defadvice, which would have to be changed.

I don't know if the functionality of ispell-multi should be enabled by
default, or only if the user requests it.

All three files are available here:
http://www.dur.ac.uk/p.j.heslin/Software/Emacs/index.php

Peter

-- 
Peter Heslin (http://www.dur.ac.uk/p.j.heslin)






reply via email to

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