emacs-devel
[Top][All Lists]
Advanced

[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 17:52:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

"Stephen J. Turnbull" <address@hidden> writes:

> David Kastrup writes:
>
>  > > The translation table operates on the decoded contents.
>  > 
>  > Why would something be decoded twice in a row?
>
> Who can give a complete description?  I can't, but sometimes it's
> useful, just as sometimes tr(1) is useful.
>
>  > I am missing the big picture here in some manner.  Does decoding not
>  > start from a byte stream but rather from an emacs-utf-8 encoded version
>  > of a byte stream?
>
> Either (see Eli's reply).  But the translation table is an add-on, not
> part of the bytes-to-character coding system itself.

Huh.  Then maybe I am not doing this right.  I want to use a "process
coding system" to efficiently sift through Midi data and leaves some
useful form (a more versatile form would likely be the Lisp reader
equivalent of MidiXML).

> XEmacs's coding system stuff is quite different (don't start, I'm
> trying to be helpful in lieu of a real expert), so I can't be sure,
> but your definition
>
> (define-coding-system 'midi
>   "This converts Midi note-on events to note names"
>   :mnemonic ?M
>   :coding-type 'charset
>   :eol-type 'unix
>   :decode-translation-table 'midi-decode-table
>   :mime-text-unsuitable t)
>
> doesn't match the idioms used throughout the rest of the :coding-type
> 'charset coding systems.

I'd have no idea.  The DOC string for define-coding-system lists the
various possibilities, but does not bother mentioning the actual
_meaning_ of the setting.

> Specifically, I suspect the :charset-list property is required for
> anything useful to happen.

Again, the DOC string for define-coding-system does not bother
mentioning what this is supposed to be for.  And the Elisp manual only
bothers with using coding systems rather than defining them.

> Also, I suspect :coding-type 'charset requires a unibyte charset.

I have no idea.

> I'm not sure it can be made to work for you, as your "characters" seem
> to be multibyte.

I have no idea.  The Midi device I open with make-serial-process
obviously delivers bytes.

> Try adding :charset-list '(latin-1) (or maybe '(raw-text)) to your
> definition.  That should just translate bytes to internal
> representation of the characters with codes 0-255, and then your
> translation table should DTRT.  If that doesn't do the trick, you'll
> have to ask Ken Handa most likely.

It would seem that Handa-san is currently the only documentation for the
coding system details Emacs has.  Some more redundancy might be a good
idea.

-- 
David Kastrup



reply via email to

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