Gnus development mailing list
 help / color / mirror / Atom feed
From: Alex Tomlinson <alext@netpliance.com>
Subject: BUG: ispell appears to hang.  FIX: change ispell-skip-region-alist.
Date: 04 May 2000 17:41:02 -0500	[thread overview]
Message-ID: <82hfcekkg1.fsf_-_@atbsd.netpliance.net> (raw)
In-Reply-To: Shenghuo ZHU's message of "04 May 2000 17:52:58 -0400"


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



                 reply	other threads:[~2000-05-04 22:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=82hfcekkg1.fsf_-_@atbsd.netpliance.net \
    --to=alext@netpliance.com \
    /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.
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).