[Top][All Lists]

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

Re: Creating a coding system

From: David Kastrup
Subject: Re: Creating a coding system
Date: Sat, 20 Dec 2014 18:38:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: David Kastrup <address@hidden>
>> Date: Sat, 20 Dec 2014 17:43:40 +0100
>> Cc: address@hidden
>> Andreas Schwab <address@hidden> writes:
>> >>> The translation table operates on the decoded contents.
>> >>
>> >> Why would something be decoded twice in a row?
>> >
>> > You don't know the characters before decoding.
>> That's an "Andreas" answer: an insider joke comprehensible only once you
>> already know the answer.  It's not even a hint.
> :-)
> Let me try being a bit more helpful.  The translation table is a
> char-table that converts one character into another.  Since these
> tables convert _characters_, you need to have a character before you
> apply the table.

Ok, so the table is not actually a "decoding-table" but rather a table
applied after decoding.  So basically it provides the same sort of
functionality/level as


    VALUE must be a function to call after some text is inserted and
    decoded by the coding system itself and before any functions in
    `after-insert-functions' are called.  This function is passed one
    argument; the number of characters in the text to convert, with
    point at the start of the text.  The function should leave point
    the same, and return the new character count.

does, but employing a different mechanism.

> To have a character, you need to decode the byte stream into
> characters.
> You can find more details on this in the node "Translation of
> Characters" in the ELisp manual.

Huh.  I'll look again, but I _did_ look in the manual previously.  Maybe
a coding system is not even the right way to do this, but at least it
seems like a builtin mechanism and consequently fast.  But at least the
decoding table does not appear to be able to _drop_ unwanted bytes: if
my TO vector is empty for any sequence, the table construction fails,
apparently when constructing the (unneeded) reverse table.

David Kastrup

reply via email to

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