From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Agustin Martin Newsgroups: gmane.emacs.devel Subject: Re: flyspell.el and non-word characters in CASECHARS Date: Wed, 18 Apr 2012 18:26:19 +0200 Message-ID: <20120418162619.GA3478@agmartin.aq.upm.es> References: <838vhvsb7q.fsf@gnu.org> <20120417172635.GA26574@agmartin.aq.upm.es> <83y5puqmar.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qDbXVdCdHGoSgWSk" X-Trace: dough.gmane.org 1334766398 2678 80.91.229.3 (18 Apr 2012 16:26:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 18 Apr 2012 16:26:38 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 18 18:26:36 2012 Return-path: Envelope-to: ged-emacs-devel@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 1SKXiF-0001kn-CR for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2012 18:26:35 +0200 Original-Received: from localhost ([::1]:55356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKXiE-0004po-Pa for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2012 12:26:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKXi8-0004pW-3t for emacs-devel@gnu.org; Wed, 18 Apr 2012 12:26:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKXi2-0007Ho-Lx for emacs-devel@gnu.org; Wed, 18 Apr 2012 12:26:27 -0400 Original-Received: from fibonacci.ccupm.upm.es ([138.100.198.70]:39378 helo=smtp.upm.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKXi2-0007HQ-Bk for emacs-devel@gnu.org; Wed, 18 Apr 2012 12:26:22 -0400 Original-Received: from agmartin.aq.upm.es (Agmartin.aq.upm.es [138.100.41.131]) by smtp.upm.es (8.14.3/8.14.3/fibonacci-001) with ESMTP id q3IGQJbP029885; Wed, 18 Apr 2012 18:26:19 +0200 Original-Received: by agmartin.aq.upm.es (Postfix, from userid 1000) id 73B0E6FF; Wed, 18 Apr 2012 18:26:19 +0200 (CEST) Mail-Followup-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: <83y5puqmar.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 138.100.198.70 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:149768 Archived-At: --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Apr 17, 2012 at 08:51:24PM +0300, Eli Zaretskii wrote: > > Date: Tue, 17 Apr 2012 19:26:36 +0200 > > From: Agustin Martin > > > > The only reason I can think is that at that time there is no way to know if > > that wordchar is going to be in the middle of a word or not. If it appears > > at a word boundary, is not what ispell.el seems to consider a wordchar. > > But in that case, the following non-word character (blank or > punctuation) will trigger the spell-check of the word. So we lose > nothing, right? > > > Did your test work only with CASECHARS instead of CASECHARS+OTHERCHARS? > > I actually _added_ to the word-syntax test the test against CASECHARS, > like this: > > ((or (and (= flyspell-pre-point (- (point) 1)) > (or (eq (char-syntax (char-after flyspell-pre-point)) ?w) > (string-match-p (flyspell-get-casechars) > (buffer-substring-no-properties > flyspell-pre-point (1+ flyspell-pre-point))))) > (= flyspell-pre-point (point)) > (= flyspell-pre-point (+ (point) 1))) > nil) I tested with your changes and they do not seem to help here. I put some (message "") to check when the casechars test is reached and in a small text showing this behavior I found no match (not previously matched by word syntax). I put an otherchars test and also did not help, but at least there is a proper match in otherchars. Anyway, adding otherchars test did not help directly but did indirectly. When testing otherchars I noticed that flyspell.el seems to honour delays for dashes, but not for otherchars. Words are checked inmediately after apostrophe, but check is properly delayed for dashes. I have been playing with enabling delays also for otherchars together with adding an otherchars test. I think I tried this morning these changes and had problems with things like sdasd'ss and friends, but now they seem to work well. I am a bit confused, I probably tested something different. Does attached diff help at your site? -- Agustin --qDbXVdCdHGoSgWSk Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="flyspell.el_use-otherchars.diff" --- flyspell.el.orig 2012-04-12 15:06:12.780784001 +0200 +++ flyspell.el 2012-04-18 10:12:57.749272942 +0200 @@ -739,7 +739,11 @@ (eq flyspell-pre-pre-buffer flyspell-pre-buffer)) nil) ((or (and (= flyspell-pre-point (- (point) 1)) - (eq (char-syntax (char-after flyspell-pre-point)) ?w)) + (or (eq (char-syntax (char-after flyspell-pre-point)) ?w) + (string-match-p (ispell-get-otherchars) + (buffer-substring-no-properties + flyspell-pre-point (1+ flyspell-pre-point))) + )) (= flyspell-pre-point (point)) (= flyspell-pre-point (+ (point) 1))) nil) @@ -815,6 +819,7 @@ (save-excursion (backward-char 1) (and (looking-at (flyspell-get-not-casechars)) + (not (looking-at (ispell-get-otherchars))) (or flyspell-consider-dash-as-word-delimiter-flag (not (looking-at "-")))))) ;; yes because we have reached or typed a word delimiter. @@ -880,6 +885,7 @@ (save-excursion (backward-char 1) (and (and (looking-at (flyspell-get-not-casechars)) 1) + (not (looking-at (ispell-get-otherchars))) (and (or flyspell-consider-dash-as-word-delimiter-flag (not (looking-at "\\-"))) 2)))))) c)))) @@ -895,6 +901,7 @@ (save-excursion (backward-char 1) (and (looking-at (flyspell-get-not-casechars)) + (not (looking-at (ispell-get-otherchars))) (or flyspell-consider-dash-as-word-delimiter-flag (not (looking-at "\\-")))))))) c)) --qDbXVdCdHGoSgWSk--