Gnus development mailing list
 help / color / mirror / Atom feed
* BUG: ispell appears to hang.  FIX: change ispell-skip-region-alist.
@ 2000-05-04 22:41 Alex Tomlinson
  0 siblings, 0 replies; only message in thread
From: Alex Tomlinson @ 2000-05-04 22:41 UTC (permalink / raw)



I posted this message to:

        comp.emacs.xemacs
        gnu.emacs.gnus
        ispell-el-bugs@itcorp.com

I'm sending it to this list because it affects gnus users who run ispell
on outgoing messages.  Original message follows.

================================================================

The default definition for ispell-skip-region-alist contains a regexp
to skip computer names.  Its form is

    "\\(/\\|\\(\\(\\w\\|-\\)+[.:@]\\)\\)\\(\\w\\|-\\)*\\([.:/@]+\\(\\w\\|-\\|~\\)+\\)+"

In certain cases, the regexp causes 're-search-forward' to take so long
that it appears to hang ispell.  The problem occurs when the hyphen 
char (-) is part of the word syntax class (\\w) and if the buffer 
contains a string of hyphens.

For example, run 

        M-x modify-syntax-entry - w

to put '-' into the word class.

Then set up a buffer with the following text

        --------------------------------------------

Running ispell-buffer on that buffer takes way too long.
If you system is fast, try a longer string.

Shorten the string to lengh 8:

        --------

And it will finish in reasonable time.

My fix was to simplify the expression to:

        "[/a-zA-Z0-9][-.:_a-zA-Z0-9]*[@/][-.:_a-zA-Z0-9@/~]+"

which is probably mis-matches on occasion, but it's a lot faster!

You can do this by adding this to your .emacs file:

;; The default definition for ispell-skip-region-alist is horribly
;; inefficent if '-' happens to be in the word syntax class.  To test,
;; run ispell with the default definition on a buffer that contains a
;; string like this: "----------------------".  You'll have to wait a
;; minute or more to search for the regexp.  Do it again with a shorter
;; string (eg, "----------") and you'll notice it will be a bit faster,
;; but still slow.  The culprit is a bunch of "\\(\\w|-\\)+" in the
;; default regexp.
(setq ispell-skip-region-alist
  '((ispell-words-keyword	   forward-line)
    (ispell-dictionary-keyword	   forward-line)
    (ispell-pdict-keyword	   forward-line)
    (ispell-parsing-keyword	   forward-line)
    ("^---*BEGIN PGP [A-Z ]*--*" . "^---*END PGP [A-Z ]*--*")
    ("^---* \\(Start of \\)?[Ff]orwarded"   . "^---* End of [Ff]orwarded")
    ;; identifying computer names and urls
    ("[/a-zA-Z0-9][-.:_a-zA-Z0-9]*[@/][-.:_a-zA-Z0-9@/~]+")))




I'm running xemacs with this version (taken
from xemacs/xemacs-packages/lisp/ispell/ispell.el):

;; Copyright (C) 1994, 1995, 1997, 1998, 1999 Free Software Foundation, Inc.
;; Authors         : Ken Stevens <k.stevens@ieee.org>
;; Stevens Mod Date: Mon 29 Nov 11:38:34 PST 1999
;; Stevens Revision: 3.3
;; Status          : Release with 3.1.12+ and 3.2.0+ ispell.
;; Bug Reports     : ispell-el-bugs@itcorp.com
;; Web Site        : http://kdstevens.com/~stevens/ispell-page.html


-- 
Alex Tomlinson <alext@netpliance.com>
Netpliance, Inc., 7600-A N. Hwy 360, Austin, TX 78731
Tel:512-493-8337, FAX:512-493-8399, http://www.netpliance.net



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-05-04 22:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-04 22:41 BUG: ispell appears to hang. FIX: change ispell-skip-region-alist Alex Tomlinson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).