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: Ispell and unibyte characters
Date: Fri, 13 Apr 2012 18:38:23 +0200	[thread overview]
Message-ID: <20120413163823.GA26947@agmartin.aq.upm.es> (raw)
In-Reply-To: <83ehrr39wq.fsf@gnu.org>

On Fri, Apr 13, 2012 at 06:53:57PM +0300, Eli Zaretskii wrote:
> > Date: Fri, 13 Apr 2012 17:25:25 +0200
> > From: Agustin Martin <agustin.martin@hispalinux.es>
> > 
> > > I don't understand what are you trying to accomplish by encoding
> > > OTHERCHARS in UTF-8.  What exactly is the problem with them being
> > > encoded in some 8-bit encoding?  Please explain.
> > 
> > Imagine a fake entry in the general list, either in ispell.el or provided
> > through `ispell-base-dicts-override-alist' (no accented chars for simplicity)
> > 
> > ("catala8"
> >      "[A-Za-z]" "[^A-Za-z]" "['\267-]" nil ("-B" "-d" "catalan") nil iso-8859-1)
> > 
> > Unless emacs knows the encoding for \267 (middledot "·") it cannot decode it
> > properly. I prefer to not use UTF-8 here, because I want the entry to also be
> > useful for ispell (and also be XEmacs incompatible). The best approach here
> > seems to decode the otherchars regexp according to provided coding-system.
> > 
> > I have noticed that there seems to be no need to encode the resulting string
> > in UTF-8, Emacs will know what to do with the decoded string.
> > 
> > I tested something like
> > 
> >  (dolist (adict ispell-dictionary-alist)
> >   	    (add-to-list 'tmp-dicts-alist
> >    			 (list
> >    			  (nth 0 adict)  ; dict name
> >     			  "[[:alpha:]]"  ; casechars
> >     			  "[^[:alpha:]]" ; not-casechars
> > 			  (if ispell-encoding8-command
> > 			      ;; Decode 8bit otherchars if needed
> > 			      (decode-coding-string (nth 3 adict) (nth 7 adict))
> > 			    (nth 3 adict)) ; otherchars
> >     			  (nth 4 adict)  ; many-otherchars-p
> >    			  (nth 5 adict)  ; ispell-args
> >    			  (nth 6 adict)  ; extended-character-mode
> > 			  (if ispell-encoding8-command
> > 			      'utf-8
> > 			    (nth 7 adict)))))
> > 
> > and seems to work well.
> 
> So you are taking the Catalan dictionary spec written for Ispell and
> convert it to a spec that could be used to support more characters by
> using UTF-8, is that right?  If so, I find this a bit kludgey.  

I think differently and like above approach because I find it way more
versatile for general definitions. This is not a matter of ispell blind
reuse. In particular I noticed this problem in Debian with the catalan spec
written for aspell (automatically created after info provided by aspell-ca
package).  That info is written that way to also be useful for XEmacs, but
with above post-processing it can work way better for Emacs.

> How
> about having a completely separate spec instead?  More generally, why
> not separate ispell-dictionary-alist into 2 alists, one to be used
> with Ispell, the other to be used with aspell and hunspell?  I think
> this would be cleaner, don't you agree?

As a matter of fact that is what we do in Debian from info provided by
ispell, aspell and hunspell dicts maintainers. The difference is that the
provided info is supposed to be valid for both Emacs and XEmacs, so
I find post-processing as above very useful, because it helps to take the
best for Emacs. Global dicts alist is built from

(dolist (dict (append found-dicts-alist
  	    ispell-base-dicts-override-alist
	    ispell-dictionary-base-alist))

where first found wins. `found-dicts-alist' has the result of automatic
search (currently used only for aspell) and has higher priority, 
`ispell-dictionary-base-alist' is the fallback alist having the lower
priority. Depending on the spellchecker 
`ispell-base-dicts-override-alist' is set to an alist corresponding to
ispell, aspell or hunspell dictionaries (they are handled independently)

I do not think that maintaining separate hardcoded dict lists in ispell.el
for ispell, aspell and hunspell worths.

For hunspell, in the future I'd go for some sort of parsing mechanism like
current one for aspell.

-- 
Agustin



  reply	other threads:[~2012-04-13 16:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-17 18:46 Ispell and unibyte characters Eli Zaretskii
2012-03-26 17:39 ` Agustin Martin
2012-03-26 20:08   ` Eli Zaretskii
2012-03-26 22:07     ` Lennart Borgman
2012-03-28 19:18     ` Agustin Martin
2012-03-29 18:06       ` Eli Zaretskii
2012-03-29 21:13         ` Andreas Schwab
2012-03-30  6:28           ` Eli Zaretskii
2012-04-26  9:54         ` Eli Zaretskii
2012-04-10 19:08       ` Agustin Martin
2012-04-10 19:11         ` Eli Zaretskii
2012-04-12 14:36           ` Agustin Martin
2012-04-12 19:01             ` Eli Zaretskii
2012-04-13 15:25               ` Agustin Martin
2012-04-13 15:53                 ` Eli Zaretskii
2012-04-13 16:38                   ` Agustin Martin [this message]
2012-04-13 17:51                 ` Stefan Monnier
2012-04-13 18:44                   ` Agustin Martin
2012-04-14  1:57                     ` Stefan Monnier
2012-04-15  0:02                       ` Agustin Martin
2012-04-16  2:40                         ` Stefan Monnier
2012-04-20 15:25                           ` Agustin Martin
2012-04-20 15:36                             ` Eli Zaretskii
2012-04-20 16:17                               ` Agustin Martin
2012-04-21  2:17                                 ` Stefan Monnier

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=20120413163823.GA26947@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).