unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: handa@gnu.org (K. Handa)
To: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Creating a coding system
Date: Tue, 23 Dec 2014 17:59:13 +0900	[thread overview]
Message-ID: <87fvc63foe.fsf@gnu.org> (raw)
In-Reply-To: <87ppbeitcs.fsf@fencepost.gnu.org> (message from David Kastrup on Sat, 20 Dec 2014 10:05:39 +0100)

Hi, sorry for the late response.

In article <87ppbeitcs.fsf@fencepost.gnu.org>, David Kastrup <dak@gnu.org> 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,,,,")
[...]
> (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)

Please add
  :charset-list '(iso-8859-1)
to the arguments of define-ccoding-system.

The translation table of coding system works AFTER byte
sequences are decoded into char sequences by the basic
decoding routine which is specified by :coding-type (and the
other additional attributes).  As it seems that you are
expecting that the basic decoding routine decodes the byte
144 to the character 144, using the following set is good:
  :coding-type 'charset
  :charset-list '(iso-8859-1)

The other method is to use CCL (i.e :coding-type 'ccl), but,
if the combination of the charset decoding and translation
table works, it's faster than running CCL code.  If you need
arithmetic or conditional operation, you have to use CCL, or
:post-read-conversion.

---
K. Handa
handa@gnu.org

PS.  Should I read the other mails of this thread?  I'm very
sorry for this lazy attitude, but I don't have a time to
read all emacs-devel mails.



  parent reply	other threads:[~2014-12-23  8:59 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-20  9:05 Creating a coding system David Kastrup
2014-12-20 10:20 ` Thien-Thi Nguyen
2014-12-20 10:42   ` David Kastrup
2014-12-20 13:51 ` Andreas Schwab
2014-12-20 14:19   ` David Kastrup
2014-12-20 14:50     ` Eli Zaretskii
2014-12-20 15:56     ` Thien-Thi Nguyen
2014-12-20 16:11     ` Andreas Schwab
2014-12-20 16:14     ` Andreas Schwab
2014-12-20 16:43       ` David Kastrup
2014-12-20 16:53         ` Eli Zaretskii
2014-12-20 17:38           ` David Kastrup
2014-12-20 18:31             ` Stephen J. Turnbull
2014-12-20 18:40               ` David Kastrup
2014-12-20 18:35             ` Eli Zaretskii
2014-12-20 19:06               ` David Kastrup
2014-12-20 20:02                 ` Eli Zaretskii
2014-12-20 20:11                   ` David Kastrup
2014-12-20 20:45                     ` Eli Zaretskii
2014-12-20 21:15                       ` David Kastrup
2014-12-21 19:46                         ` David Kastrup
2014-12-21 21:25                       ` David Kastrup
2014-12-21  5:54                 ` Stephen J. Turnbull
2014-12-20 16:21     ` Stephen J. Turnbull
2014-12-20 16:52       ` David Kastrup
2014-12-20 18:34         ` Eli Zaretskii
2014-12-20 18:42           ` David Kastrup
2014-12-23  8:59 ` K. Handa [this message]
2014-12-23  9:25   ` David Kastrup
2014-12-24 15:06     ` K. Handa
2014-12-25  6:39       ` David Kastrup
2014-12-29 14:11         ` K. Handa
2014-12-29 14:25           ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvc63foe.fsf@gnu.org \
    --to=handa@gnu.org \
    --cc=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).