From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Aleksey Cherepanov Newsgroups: gmane.emacs.bugs Subject: bug#16800: 24.3; flyspell works slow on very short words at the end of big file Date: Sat, 22 Feb 2014 16:44:13 +0400 Message-ID: <20140222124413.GA4971@openwall.com> References: <85zjlo5ecy.fsf@gmail.com> <83ob204vrv.fsf@gnu.org> <20140221143855.GA6018@agmartin.aq.upm.es> <83k3co4hzd.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1393073139 1447 80.91.229.3 (22 Feb 2014 12:45:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 22 Feb 2014 12:45:39 +0000 (UTC) Cc: 16800@debbugs.gnu.org, Agustin Martin To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 22 13:45:45 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WHBxg-000108-Mj for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Feb 2014 13:45:44 +0100 Original-Received: from localhost ([::1]:49329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHBxg-0002KN-BW for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Feb 2014 07:45:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHBx7-0001f9-C3 for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2014 07:45:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHBx1-0006tL-U2 for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2014 07:45:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHBx1-0006rx-RI for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2014 07:45:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WHBx0-0003Ts-JS for bug-gnu-emacs@gnu.org; Sat, 22 Feb 2014 07:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Aleksey Cherepanov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Feb 2014 12:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16800 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16800-submit@debbugs.gnu.org id=B16800.139307306613315 (code B ref 16800); Sat, 22 Feb 2014 12:45:02 +0000 Original-Received: (at 16800) by debbugs.gnu.org; 22 Feb 2014 12:44:26 +0000 Original-Received: from localhost ([127.0.0.1]:35438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHBwP-0003Sg-Op for submit@debbugs.gnu.org; Sat, 22 Feb 2014 07:44:26 -0500 Original-Received: from mail-la0-f54.google.com ([209.85.215.54]:63924) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHBwN-0003SQ-64 for 16800@debbugs.gnu.org; Sat, 22 Feb 2014 07:44:24 -0500 Original-Received: by mail-la0-f54.google.com with SMTP id y1so3471688lam.13 for <16800@debbugs.gnu.org>; Sat, 22 Feb 2014 04:44:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=qqwyZANC0ODhGkqPiRL6RnhC6Jq77Dm6EI7OqZmdRkg=; b=V9QYHPkD53xIoZGvqtuSuuuSv7rBqbJHPO44gwiDQssxbnZBhGvbL74RYAz6YRWACD DXB0fRuysUFnlT7LRqY3qUEznqvEIyD9ICBcw/YGDXVNYkzMAJfwW4YzEqULLyvc6fwW J5Hk1G4L7y12hQr79m5ak9b7zEIZbyZ4PIKsMQOp5pxaP/pzD9mpb4BNWHAxX0+P8KHT NqmE7YfRMRASSUciTPYMkBSgqY/+a/ZxFmIVw6ZgDiqFRary0WFJBlAHnJB6YPubJji1 sGBZ/j141HqNiEmasXa4/EZGgrwHRllSm+wseI7E70wY2lQvBb6VCi4mAXNr0mTk92m7 G02Q== X-Received: by 10.112.148.104 with SMTP id tr8mr6525700lbb.62.1393073056921; Sat, 22 Feb 2014 04:44:16 -0800 (PST) Original-Received: from openwall.com ([188.123.230.115]) by mx.google.com with ESMTPSA id cl5sm11196971lbb.14.2014.02.22.04.44.15 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 22 Feb 2014 04:44:16 -0800 (PST) Content-Disposition: inline In-Reply-To: <83k3co4hzd.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:86017 Archived-At: On Fri, Feb 21, 2014 at 05:12:54PM +0200, Eli Zaretskii wrote: > > Date: Fri, 21 Feb 2014 15:38:55 +0100 > > From: Agustin Martin > > Cc: 16800@debbugs.gnu.org > > > > On Wed, Feb 19, 2014 at 12:56:45AM +0400, Aleksey Cherepanov wrote: > > > flyspell-duplicate-distance variable on its own could mitigate the > > > problem but it changes the behaviour so I do not want to use this > > > variable. > > What behavior does it change? Do you really care to have a > mis-spelled word be highlighted in a different face just because > there's an identical mis-spelling half a megabyte away? Yes, as a user I really care about this and as a programmer I believe the bug could be solved well. Also GNU coding standards say to avoid arbitrary limits (parts 2.1 and 4.2). http://www.gnu.org/prep/standards/standards.html But I could accept that this bug has low severity because there is flyspell-duplicate-distance variable that could be used as a workaround. > > For the records, I was playing with a customized value of 50000 for that > > distance and even if there is still a minor delay it is reasonable. I am > > in a fast box, do not know in other boxes. > > I would suggest to change the default to something finite, like 20000 > perhaps. Having it set to -1 by default is IMO unwieldy, since > buffers can be very large. > > > > I tried to patch flyspell-word-search-backward and > > > flyspell-word-search-forward functions from flyspell.el replacing > > > search-backward with word-search-backward and search-forward with > > > word-search-forward (perl -pe 's/\(search-/(word-search-/' ). It > > > solved the problem but I do not know what it broke. > > And this doesn't change behavior? See below. No, it seems that my setup works the same. See below. > > > I expect problems with this solution because I do not know if > > > flyspell's meaning of word is the same as emacs' one. I think it is > > > described in flyspell-get-word function that is called after search-* > > > in the patched functions. > > > > I have never played with Emacs syntax tables, but I'd expect differences > > only if there is a mismatch between chars in OTHERCHARS and non > > alphabetic chars that Emacs considers as possible parts of a word. > > The effect depends on the language, I think. If I'd believe that it is a right solution I'd send a patch. The difference is in word bounds. We are in trouble if flyspell's word on its ends does not have ends of emacs' word. If flyspell's word has ends of emacs' word on its ends and even contain them inside then we are ok (try to search "a b" over "aa bb a b aa bb"). So could ends of flyspell's word do not match with ends of emacs' word? So I think word search instead of regular search does not change behaviour of my setup with EN and RU languages (both at the same time) and excplicitly specified ispell-dictionary-alist (I used some popular instructions as is to setup it so long time ago). ispell-dictionary-alist contains character sets used by flyspell-get-word. As an alternative I think we could generate regexps on the fly with flyspell's word boundaries around words and search them. It would be like (re-search-forward (concat "\\<" (regexp-quote word) "\\>") bound t) instead of (word-search-forward word bound t) but with flyspell's word boundaries instead of "\\<" and "\\>". Thanks! -- Regards, Aleksey Cherepanov