From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Creating a coding system Date: Sat, 20 Dec 2014 17:52:29 +0100 Message-ID: <87vbl6gt6a.fsf@fencepost.gnu.org> References: <87ppbeitcs.fsf@fencepost.gnu.org> <87sigasa3n.fsf@igel.home> <878ui2ieu1.fsf@fencepost.gnu.org> <87d27ecmwq.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1419094374 11170 80.91.229.3 (20 Dec 2014 16:52:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2014 16:52:54 +0000 (UTC) Cc: Andreas Schwab , emacs-devel@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 17:52:47 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y2NGn-0006Lq-QI for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2014 17:52:45 +0100 Original-Received: from localhost ([::1]:35168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2NGn-0005f0-4R for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2014 11:52:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2NGa-0005ef-IW for emacs-devel@gnu.org; Sat, 20 Dec 2014 11:52:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2NGZ-0006FO-Hb for emacs-devel@gnu.org; Sat, 20 Dec 2014 11:52:32 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2NGZ-0006FK-Dn for emacs-devel@gnu.org; Sat, 20 Dec 2014 11:52:31 -0500 Original-Received: from localhost ([127.0.0.1]:47512 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2NGY-0005ax-9N; Sat, 20 Dec 2014 11:52:30 -0500 Original-Received: by lola (Postfix, from userid 1000) id BC6E5E056B; Sat, 20 Dec 2014 17:52:29 +0100 (CET) In-Reply-To: <87d27ecmwq.fsf@uwakimon.sk.tsukuba.ac.jp> (Stephen J. Turnbull's message of "Sun, 21 Dec 2014 01:21:25 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:180387 Archived-At: "Stephen J. Turnbull" 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