emacs-devel
[Top][All Lists]
Advanced

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

Re: Creating a coding system


From: K. Handa
Subject: Re: Creating a coding system
Date: Tue, 23 Dec 2014 17:59:13 +0900

Hi, sorry for the late response.

In article <address@hidden>, David Kastrup <address@hidden> 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
address@hidden

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.



reply via email to

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