unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Agustin Martin <agustin.martin@hispalinux.es>
To: emacs-devel@gnu.org
Subject: Re: flyspell.el and non-word characters in CASECHARS
Date: Wed, 18 Apr 2012 18:26:19 +0200	[thread overview]
Message-ID: <20120418162619.GA3478@agmartin.aq.upm.es> (raw)
In-Reply-To: <83y5puqmar.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]

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 <agustin.martin@hispalinux.es>
> > 
> > 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

[-- Attachment #2: flyspell.el_use-otherchars.diff --]
[-- Type: text/x-diff, Size: 1520 bytes --]

--- 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))

  reply	other threads:[~2012-04-18 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 19:55 flyspell.el and non-word characters in CASECHARS Eli Zaretskii
2012-04-17 17:26 ` Agustin Martin
2012-04-17 17:51   ` Eli Zaretskii
2012-04-18 16:26     ` Agustin Martin [this message]
2012-04-18 18:45       ` Eli Zaretskii
2012-04-20 15:26         ` Agustin Martin

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120418162619.GA3478@agmartin.aq.upm.es \
    --to=agustin.martin@hispalinux.es \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).