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 15:19:18 +0100 Message-ID: <878ui2ieu1.fsf@fencepost.gnu.org> References: <87ppbeitcs.fsf@fencepost.gnu.org> <87sigasa3n.fsf@igel.home> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1419085175 6751 80.91.229.3 (20 Dec 2014 14:19:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2014 14:19:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 15:19:28 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 1Y2KsS-0007ol-3t for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2014 15:19:28 +0100 Original-Received: from localhost ([::1]:34523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2KsR-0003Pf-Gw for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2014 09:19:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2KsO-0003PZ-9d for emacs-devel@gnu.org; Sat, 20 Dec 2014 09:19:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y2KsJ-0001Ja-Qu for emacs-devel@gnu.org; Sat, 20 Dec 2014 09:19:24 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2KsJ-0001JA-Nd for emacs-devel@gnu.org; Sat, 20 Dec 2014 09:19:19 -0500 Original-Received: from localhost ([127.0.0.1]:36335 helo=lola) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y2KsI-0003qD-Kk; Sat, 20 Dec 2014 09:19:18 -0500 Original-Received: by lola (Postfix, from userid 1000) id 3C49EE056B; Sat, 20 Dec 2014 15:19:18 +0100 (CET) In-Reply-To: <87sigasa3n.fsf@igel.home> (Andreas Schwab's message of "Sat, 20 Dec 2014 14:51:24 +0100") 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:180375 Archived-At: Andreas Schwab writes: > David Kastrup writes: > >> Ok, what am I doing wrong here? Why does decode-coding-string not do >> anything here? >> >> (define-translation-table 'midi-decode-table >> (make-translation-table-from-alist >> (mapcar >> (lambda (p) >> (cons (car p) (string-to-vector (cdr p)))) >> '(([144 0] . "c,,,,") > > The translation table operates on the decoded contents. Why would something be decoded twice in a row? >> (prin1 (decode-coding-string "\220\040" 'midi)) > (aref (string-make-multibyte "\220\040") 0) => 4194192 (aref "\220\040" 0) => 144 But admittedly, (decode-coding-string (string 144 64) 'midi) => "e'" which does not make a whole lot of sense to me since my use case (make-serial-process :port "/dev/snd/midiC1D0" :speed nil :coding 'midi :noquery t) does absolutely nothing, and that should be decoding from _bytes_ to _characters_ rather than _characters_ (including some raw-character code page) to _characters_. 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? That does not seem to make sense to me. -- David Kastrup