[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug 130397

From: Stefan
Subject: Re: Bug 130397
Date: Tue, 04 Jan 2005 09:55:09 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> Hmmm, then how about the attached patch to the latest CVS
> emacs?  With that, all equivalent charaters (e.g a-grave in
> all laitn-X) should be handled well.  This patch will be
> applicable also to Emacs 21.3 but not yet tested in that
> version.

Can someone explain to me why ispell.el needs those kinds of things?

My vague understanding is that ispell.el needs to know which chars are part
of a word and that in the past (pre-MULE), this had to be redefined for each
and every language since the codes 128-255 could mean completely
different things.

Why can't ispell.el just use the `w' syntax to decide what is a word and
then rely on the decoding/encoding to do the rest of the work?

That would fix the problem where a word like "expérience" is checked as two
words if the dictionary is "american".

> + ;; Char-table that maps an Unicode character (charset:
> + ;; latin-iso8859-1, mule-unicode-0100-24ff) to
> + ;; a string in which all equivalent characters are listed.
> + 
> + (defconst ispell-unified-chars-table
> +   (let ((table (make-char-table 'ispell-unified-chars-table)))
> +     (map-char-table
> +      #'(lambda (c v)
> +      (if (and v (/= c v))
> +          (let ((unified (or (aref table v) (string v))))
> +            (aset table v (concat unified (string c))))))
> +      ucs-mule-8859-to-mule-unicode)
> +     table))

All the elements of this table should be multibyte strings.
For this, we may need to wrap the (string X) into
(string-to-multibyte (string X))

> +             (string-as-multibyte
> +              (mapconcat
> +               #'(lambda (c)
> +                   (let ((unichar (aref ucs-mule-8859-to-mule-unicode c)))
> +                     (if unichar
> +                         (aref ispell-unified-chars-table unichar)
> +                       (string c))))
> +               str ""))))

Do you expect the output of mapconcat to be unibyte and to contain
emacs-mule encoding of multibyte chars?  I don't.
So I'd recommend string-to-multibyte rather than string-as-multibyte.
If I'm wrong, could you explain where the emacs-mule encoding
got introduced?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]