From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kenichi Handa <handa@m17n.org>
Cc: emacs-devel@gnu.org
Subject: Re: Best way to intercept terminal escape sequences?
Date: Wed, 08 Sep 2010 11:05:20 +0200 [thread overview]
Message-ID: <jwv8w3cbom8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <tl7tym2xuja.fsf@m17n.org> (Kenichi Handa's message of "Tue, 07 Sep 2010 09:32:41 +0900")
>>>> As mentioned, read-event did not do obey keyboard-coding-system in
>>>> earlier Emacsen, so any affected package is more likely to be fixed than
>>>> broken by making a change that reverts to this previous behavior.
>> > Handa, could you take a look at the feasibility of moving the
>> > decode_keyboard_code to a later stage such that read-event still returns
>> > raw bytes for ttys?
>> ping?
> "... read-event still returns raw bytes" means that you can't get, for
> instance, A-ogonek event by read-event (or read-char) even if you type
> A-ogonek from a terminal. I don't remember well but one reason of
> moving keyboard-coding-system handling from keymap to the current
> place was to make read-event on tty work as the same way as that on
> graphic terminal. So, I think we should not change it.
IIRC the reason to decode earlier was so that things like
input-decode-map and friends get to see real chars rather than bytes,
but none of those reasons require read-event to always return chars.
IIRC one of the main problems with earlier code was that encoded-kb
would sometimes see bytes and sometimes chars (i.e. it would normally
see bytes under a tty except when using leim), so it sometimes
incorrectly took chars for bytes and re-decoded them.
> Is it difficult to make new functions, say tty-getc and tty-ungetc, to
> handle responsding escape sequences sent from terminal?
It doesn't look easy at all, since the current code does decoding before
placing the bytes in the event-queue (i.e. by the time Elisp code gets
a chance to look at the queue, the decoding has already taken place).
It would be better to decode later (i.e. after placing the events on
the event-queue), tho still before leim and input-decode-map.
We can then easily provide a "new" function to read "decoded events".
We could call it ... read-char ;-)
Stefan
next prev parent reply other threads:[~2010-09-08 9:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100827142724.E1DD712F@hazard.ece.cmu.edu>
2010-08-27 14:44 ` Best way to intercept terminal escape sequences? Ryan Johnson
2010-08-27 15:40 ` Eli Zaretskii
2010-08-27 18:04 ` Ryan Johnson
2010-08-27 20:38 ` Eli Zaretskii
2010-08-27 23:54 ` Stefan Monnier
2010-08-28 7:54 ` Ryan Johnson
2010-08-28 14:47 ` Stefan Monnier
2010-08-28 20:34 ` Ryan Johnson
2010-08-31 23:12 ` Ryan Johnson
2010-09-02 10:53 ` Stefan Monnier
2010-09-02 12:33 ` Ryan Johnson
2010-09-04 13:01 ` Improve input handling documentation (was Re: Best way to intercept terminal escape sequences?) Štěpán Němec
[not found] ` <jwvy6bfdp23.fsf-monnier+emacs@gnu.org>
2010-09-07 0:32 ` Best way to intercept terminal escape sequences? Kenichi Handa
2010-09-08 9:05 ` Stefan Monnier [this message]
[not found] <20100827112348.5023B3D5@osgood.ece.cmu.edu>
2010-08-27 13:56 ` Ryan Johnson
2010-08-27 14:17 ` David Kastrup
2010-08-26 15:58 Ryan Johnson
2010-08-26 23:03 ` Stefan Monnier
2010-08-27 9:28 ` Ryan Johnson
2010-08-27 10:36 ` David Kastrup
2010-08-27 23:50 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2010-08-26 13:22 Ryan Johnson
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=jwv8w3cbom8.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.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).