bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: decode-char & utf-8-fragment-on-decoding


From: Thomas Morgan
Subject: Re: decode-char & utf-8-fragment-on-decoding
Date: 05 Sep 2002 21:13:21 -0400

   > Right now it applies
   > to CCL programs, but not to decode-char.  Is that correct?
   
   I don't know what `it' refers to there.

The option `utf-8-fragment-on-decoding'.

utf-8-fragment-on-decoding's Custom set function changes the element
of translation-table-vector named `utf-8-translation-table-for-decode'.
CCL programs use this same table from translation-table-vector.
Therefore, utf-8-fragment-on-decoding applies to CCL programs.

On the other hand, utf-8-fragment-on-decoding's Custom set function does
not change the value of the variable `utf-8-translation-table-for-decode'.
decode-char uses this variable's value.  Therefore,
utf-8-fragment-on-decoding does not apply to decode-char.

Is this because utf-8-fragment-on-decoding is meant only to apply
to user-level operations like finding a file or reading email,
but decode-char should be counted on always to return the same
result to Lisp programs even when user-level options change?

                                * * *

   > If it is not correct, however, how about making decode-char look for
   > utf-8-translation-table-for-decode within translation-table-vector
   > rather than accessing the Lisp variable directly?

   I don't understand.

This would be a change from the current behavior, and I'm not sure
whether it is right or wrong.  But when you said

   The translation table is always used -- CCL has no way to access Lisp
   variables anyway.  It only matters how it's populated (empty by
   default).

it seemed to me that decode-char should use the same translation table
that CCL uses.  I just learned that this table, as well as being found
in translation-table-vector, is also the value of the `translation-table'
property for the symbol `utf-8-translation-table-for-decode'.  It is not,
however, necessarily the value of that symbol's variable definition.

So instead of

   (if (and c (aref utf-8-translation-table-for-decode c))
       (aref utf-8-translation-table-for-decode c)
     c)))))

maybe decode-char could do something like

   (let ((table (get 'utf-8-translation-table-for-decode 'translation-table)))
     (if (and c table (aref table c))
         (aref table c)
       c))

                                * * *

   I don't know what you think needs documenting -- can you suggest text?

I realized that you were right to put the explanation in decode-char
rather than utf-8-fragment-on-decoding, and thought that the following
would make the situation more clear,

   >   (Note that this char table is independent of the translation table
   >   of the same name which CCL programs use, and it is not affected by
   >   the user's setting of utf-8-fragment-on-decoding.)

but I must have misunderstood the facts.

   That seems to be the opposite of how it actually is.

Could you explain how it actually is?

I'm sorry to take up your time with something that is surely not as
important as your other activities.  I would also like to express
as a user great thanks to you and all the Emacs developers!





reply via email to

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