From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.org!not-for-mail
From: Peter Heslin
Newsgroups: gmane.emacs.devel
Subject: Adding ispell-multi.el and friends to Emacs
Date: Thu, 14 Jun 2007 13:58:54 +0100
Message-ID: <87zm32k7zl.fsf@dur.ac.uk>
NNTP-Posting-Host: lo.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: sea.gmane.org 1181825336 15856 80.91.229.12 (14 Jun 2007 12:48:56 GMT)
X-Complaints-To: usenet@sea.gmane.org
NNTP-Posting-Date: Thu, 14 Jun 2007 12:48:56 +0000 (UTC)
To: emacs-devel@gnu.org
Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 14 14:48:54 2007
Return-path:
Envelope-to: ged-emacs-devel@m.gmane.org
Original-Received: from lists.gnu.org ([199.232.76.165])
by lo.gmane.org with esmtp (Exim 4.50)
id 1Hyokq-0002e4-4E
for ged-emacs-devel@m.gmane.org; Thu, 14 Jun 2007 14:48:48 +0200
Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43)
id 1Hyokp-00013T-Ox
for ged-emacs-devel@m.gmane.org; Thu, 14 Jun 2007 08:48:47 -0400
Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
id 1Hyokl-0000zR-Di
for emacs-devel@gnu.org; Thu, 14 Jun 2007 08:48:43 -0400
Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
id 1Hyokk-0000xn-6E
for emacs-devel@gnu.org; Thu, 14 Jun 2007 08:48:42 -0400
Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1Hyokj-0000xV-Rn
for emacs-devel@gnu.org; Thu, 14 Jun 2007 08:48:41 -0400
Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org)
by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.60) (envelope-from )
id 1Hyokj-0002vI-9S
for emacs-devel@gnu.org; Thu, 14 Jun 2007 08:48:41 -0400
Original-Received: from list by ciao.gmane.org with local (Exim 4.43)
id 1Hyojp-0007Lj-W7
for emacs-devel@gnu.org; Thu, 14 Jun 2007 14:47:46 +0200
Original-Received: from class03.dur.ac.uk ([129.234.72.3])
by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
id 1AlnuQ-0007hv-00
for ; Thu, 14 Jun 2007 14:47:45 +0200
Original-Received: from p.j.heslin by class03.dur.ac.uk with local (Gmexim 0.1 (Debian))
id 1AlnuQ-0007hv-00
for ; Thu, 14 Jun 2007 14:47:45 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 56
Original-X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: class03.dur.ac.uk
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux)
Cancel-Lock: sha1:c74CJnWL7M93THJvPl3zPdaYTmU=
X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4)
X-BeenThere: emacs-devel@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions."
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org
Xref: news.gmane.org gmane.emacs.devel:72859
Archived-At:
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)